@magpie-community/opencode-kiro-auth 0.1.34 → 0.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +6 -0
  2. package/index.mjs +28 -9
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -22,6 +22,12 @@ Callback URL field. The page need not load on the browser's computer. Local
22
22
  browsers that can reach the plugin's listener finish automatically. Direct
23
23
  AWS sign-in still uses authorization code + PKCE, not device authorization.
24
24
 
25
+ In magpie, each way, question and choice shows in the window's language
26
+ (Chinese, Traditional Chinese, Japanese, German): `labels`, `messages` and
27
+ `hints` beside the English, which OpenCode shows. A Kiro subscription in
28
+ magpie opens the question above first; its other ways, the API key among
29
+ them, are under "Other ways to sign in…".
30
+
25
31
 
26
32
  - **Kiro (Google, GitHub, AWS Builder ID, IAM Identity Center)**: the Kiro
27
33
  IDE's own sign-in.
package/index.mjs CHANGED
@@ -27,6 +27,23 @@ import { homedir, hostname, platform, release } from "node:os"
27
27
  import { delimiter, join } from "node:path"
28
28
 
29
29
  const ID = "kiro"
30
+
31
+ // WORDS are the sign-in's words in magpie's other languages, beside the
32
+ // English each method, question and choice has (magpie's labels, messages
33
+ // and hints; OpenCode ignores them). Product names stay as written.
34
+ const WORDS = {
35
+ browser: { zh: "Kiro 登录(Google、GitHub、AWS Builder ID、IAM Identity Center)", "zh-TW": "Kiro 登入(Google、GitHub、AWS Builder ID、IAM Identity Center)", ja: "Kiro にサインイン(Google、GitHub、AWS Builder ID、IAM Identity Center)", de: "Kiro-Anmeldung (Google, GitHub, AWS Builder ID, IAM Identity Center)" },
36
+ choose: { zh: "选择登录方式", "zh-TW": "選擇登入方式", ja: "サインイン方法を選択", de: "Anmeldemethode wählen" },
37
+ enterprise: { zh: "IAM Identity Center(组织 Start URL)", "zh-TW": "IAM Identity Center(組織 Start URL)", ja: "IAM Identity Center(組織の Start URL)", de: "IAM Identity Center (Start-URL der Organisation)" },
38
+ enterpriseHint: { zh: "用组织的 AWS Start URL 登录", "zh-TW": "用組織的 AWS Start URL 登入", ja: "組織の AWS Start URL でサインイン", de: "Mit der AWS-Start-URL Ihrer Organisation anmelden" },
39
+ builderidHint: { zh: "直接打开 AWS 登录;在远程服务器上只需粘贴一次回调地址", "zh-TW": "直接開啟 AWS 登入;在遠端伺服器上只需貼上一次回呼網址", ja: "AWS のサインインを直接開きます。リモートサーバーではコールバックを 1 回貼り付けるだけです", de: "Öffnet die AWS-Anmeldung direkt; auf einem entfernten Server wird ein Callback einmal eingefügt" },
40
+ portal: { zh: "Kiro 登录页", "zh-TW": "Kiro 登入頁", ja: "Kiro のサインインページ", de: "Kiro-Anmeldeseite" },
41
+ portalHint: { zh: "Google、GitHub、IAM Identity Center 或 Kiro 的其他登录方式", "zh-TW": "Google、GitHub、IAM Identity Center 或 Kiro 的其他登入方式", ja: "Google、GitHub、IAM Identity Center など Kiro のサインイン方法", de: "Google, GitHub, IAM Identity Center oder andere Kiro-Anmeldemethoden" },
42
+ startUrl: { zh: "组织 Start URL", "zh-TW": "組織 Start URL", ja: "組織の Start URL", de: "Start-URL der Organisation" },
43
+ region: { zh: "AWS 区域(留空为 us-east-1)", "zh-TW": "AWS 區域(留空為 us-east-1)", ja: "AWS リージョン(空欄なら us-east-1)", de: "AWS-Region (leer: us-east-1)" },
44
+ own: { zh: "Kiro CLI 或 Kiro IDE 已登录的账号", "zh-TW": "Kiro CLI 或 Kiro IDE 已登入的帳號", ja: "Kiro CLI または Kiro IDE のサインイン", de: "Anmeldung von Kiro CLI oder Kiro IDE" },
45
+ key: { zh: "Kiro API Key(ksk_…)", "zh-TW": "Kiro API Key(ksk_…)", ja: "Kiro API キー(ksk_…)", de: "Kiro-API-Schlüssel (ksk_…)" },
46
+ }
30
47
  const MESSAGES = "@ai-sdk/anthropic"
31
48
  const BASE = "https://runtime.us-east-1.kiro.dev" // what OpenCode is given; the fetch sends each request to the account's region
32
49
 
@@ -3103,22 +3120,24 @@ export async function KiroAuthPlugin({ client } = {}) {
3103
3120
  return { error: e.message, signIn: e.gone ? "expired" : "kept" }
3104
3121
  }
3105
3122
  },
3123
+ // labels, messages and hints are magpie's own fields: the same words
3124
+ // by the window's language (OpenCode shows the English)
3106
3125
  methods: [
3107
- { type: "oauth", label: "Kiro (Google, GitHub, AWS Builder ID, IAM Identity Center)",
3108
- prompts: [{ type: "select", key: "loginMethod", message: "Choose a sign-in method", options: [
3109
- { label: "IAM Identity Center (organization Start URL)", value: "enterprise", hint: "Sign in to your organization with its AWS Start URL" },
3110
- { label: "AWS Builder ID", value: "builderid", hint: "Open AWS sign-in directly; one callback to paste on a remote server" },
3111
- { label: "Kiro sign-in page", value: "portal", hint: "Google, GitHub, IAM Identity Center or other Kiro sign-in methods" },
3126
+ { type: "oauth", label: "Kiro (Google, GitHub, AWS Builder ID, IAM Identity Center)", labels: WORDS.browser,
3127
+ prompts: [{ type: "select", key: "loginMethod", message: "Choose a sign-in method", messages: WORDS.choose, options: [
3128
+ { label: "IAM Identity Center (organization Start URL)", value: "enterprise", hint: "Sign in to your organization with its AWS Start URL", labels: WORDS.enterprise, hints: WORDS.enterpriseHint },
3129
+ { label: "AWS Builder ID", value: "builderid", hint: "Open AWS sign-in directly; one callback to paste on a remote server", hints: WORDS.builderidHint },
3130
+ { label: "Kiro sign-in page", value: "portal", hint: "Google, GitHub, IAM Identity Center or other Kiro sign-in methods", labels: WORDS.portal, hints: WORDS.portalHint },
3112
3131
  ] },
3113
- { type: "text", key: "startUrl", message: "Organization Start URL", placeholder: "https://d-xxxxxxxxxx.awsapps.com/start",
3132
+ { type: "text", key: "startUrl", message: "Organization Start URL", messages: WORDS.startUrl, placeholder: "https://d-xxxxxxxxxx.awsapps.com/start",
3114
3133
  condition: (inputs) => inputs.loginMethod === "enterprise",
3115
3134
  validate: (value) => httpsURL(String(value || "").trim()) ? undefined : "Enter an HTTPS Start URL" },
3116
- { type: "text", key: "region", message: "AWS region (blank uses us-east-1)", placeholder: "us-east-1",
3135
+ { type: "text", key: "region", message: "AWS region (blank uses us-east-1)", messages: WORDS.region, placeholder: "us-east-1",
3117
3136
  condition: (inputs) => inputs.loginMethod === "enterprise",
3118
3137
  validate: (value) => !value || AWS_REGION.test(value.trim()) ? undefined : "Enter a valid AWS region" },
3119
3138
  ], authorize: browserSignIn },
3120
- { type: "oauth", label: "Kiro CLI's or Kiro IDE's sign-in", authorize: ownSignIn },
3121
- { type: "api", label: "Kiro API key (ksk_…)" },
3139
+ { type: "oauth", label: "Kiro CLI's or Kiro IDE's sign-in", labels: WORDS.own, authorize: ownSignIn },
3140
+ { type: "api", label: "Kiro API key (ksk_…)", labels: WORDS.key, placeholder: "ksk_…" },
3122
3141
  ],
3123
3142
  },
3124
3143
  async config(config) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@magpie-community/opencode-kiro-auth",
3
- "version": "0.1.34",
3
+ "version": "0.1.35",
4
4
  "description": "Kiro subscriptions (Free, Pro, Pro+, Power) in OpenCode and magpie",
5
5
  "type": "module",
6
6
  "main": "./opencode.mjs",