@songsid/agend 2.3.2-beta.12 → 2.3.2-beta.13

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 (38) hide show
  1. package/dist/auth-api.js +2 -0
  2. package/dist/auth-api.js.map +1 -1
  3. package/dist/backend/kiro-identity.d.ts +55 -0
  4. package/dist/backend/kiro-identity.js +218 -28
  5. package/dist/backend/kiro-identity.js.map +1 -1
  6. package/dist/backend/kiro.d.ts +2 -0
  7. package/dist/backend/kiro.js +25 -4
  8. package/dist/backend/kiro.js.map +1 -1
  9. package/dist/fleet-manager.js +2 -0
  10. package/dist/fleet-manager.js.map +1 -1
  11. package/dist/general-knowledge/skills/web-dashboard/SKILL.canvas-worker-off.md +7 -1
  12. package/dist/general-knowledge/skills/web-dashboard/SKILL.md +7 -1
  13. package/dist/kiro-migrate.d.ts +5 -0
  14. package/dist/kiro-migrate.js +42 -4
  15. package/dist/kiro-migrate.js.map +1 -1
  16. package/dist/locale.js +28 -0
  17. package/dist/locale.js.map +1 -1
  18. package/dist/quickstart-api.d.ts +14 -0
  19. package/dist/quickstart-api.js +62 -11
  20. package/dist/quickstart-api.js.map +1 -1
  21. package/dist/settings-effect.js +5 -4
  22. package/dist/settings-effect.js.map +1 -1
  23. package/dist/setup-form.d.ts +2 -2
  24. package/dist/setup-form.js +124 -92
  25. package/dist/setup-form.js.map +1 -1
  26. package/dist/setup-i18n.d.ts +25 -0
  27. package/dist/setup-i18n.js +224 -0
  28. package/dist/setup-i18n.js.map +1 -0
  29. package/dist/ui/backend-signin.js +4 -3
  30. package/dist/ui/panel-settings.js +4 -2
  31. package/dist/ui/settings-discord.js +3 -2
  32. package/dist/ui/settings-strings.js +8 -2
  33. package/dist/ui/settings-token.js +3 -2
  34. package/dist/ui/settings-wizard.js +11 -6
  35. package/dist/ui/shared/setup-host-text.js +105 -0
  36. package/dist/ui/structured-signin.js +89 -38
  37. package/package.json +1 -1
  38. package/templates/windows-shortcuts.ps1 +3 -3
@@ -1,24 +1,71 @@
1
1
  /* Shared browser controls. No terminal relay, provider output or secrets in diagnostics. */
2
- const NAMES = { "kiro-cli": "Kiro", "claude-code": "Claude Code", codex: "Codex", antigravity: "Antigravity (console fallback)" };
3
- const CHOICES = { builder_id: "Builder ID", google: "Google", github: "GitHub", organization: "Your organization", subscription: "Claude subscription", console: "Anthropic Console" };
4
- const ERRORS = {
5
- unsupported_prompt: "This CLI screen is not supported. Cancel and use the console fallback.",
6
- cleanup_failed: "The login process could not be confirmed closed. Close it on the host and restart setup before retrying.",
7
- signin_cleanup_failed: "The login process could not be confirmed closed. Close it on the host and restart setup before retrying.",
8
- signin_action_stale: "That prompt changed or was already answered. Refresh its status; do not submit it again.",
9
- signin_console_only: "This backend uses the explicit console fallback.",
10
- backend_signin_local_only: "Backend sign-in is available only on this computer. Use the local setup page, or sign in later.",
11
- signin_session_expired: "This setup session has ended. Reopen setup on the host.",
12
- expired: "This login attempt expired. Start a new attempt.",
13
- auth_unconfirmed: "The CLI exited, but credentials could not be verified. Retry or sign in later.",
14
- provider_rejected: "The provider rejected this sign-in. Retry or sign in later.",
2
+ // #2726: in English and 繁體中文 — served alone to the setup page (no dashboard i18n there), so its words live here.
3
+ export const SIGNIN_STRINGS = {
4
+ en: {
5
+ heading: "Sign in your AI backends",
6
+ lead: "Use the controls here; no terminal typing is needed for Kiro, Claude Code or Codex. You can sign in later from the dashboard.",
7
+ check: "Check sign-ins", skipped: "Sign in later · remains in Needs you", valid: "Signed in ✓", notInstalled: "Not installed on this host",
8
+ consoleOnly: "Use the explicit console fallback, or sign in later.", needed: "Sign-in needed", waiting: "Waiting for the CLI…", login: "Login: {0}",
9
+ openProvider: "Open provider sign-in", deviceCode: "Device code:", answerSent: "Answer sent. Waiting for the next screen; it will not be sent twice.",
10
+ cancel: "Cancel sign-in", signIn: "Sign in", signInAgain: "Sign in again", later: "Sign in later", submit: "Submit {0}",
11
+ relogin: "Sign in again? Kiro will sign out its existing account first.", ready: "You can continue setup.",
12
+ field_code: "Paste the returned code", field_start_url: "Organization Start URL", field_region: "AWS region",
13
+ phase_method: "method", phase_code: "code", phase_start_url: "start URL", phase_region: "region", phase_authorization: "authorization",
14
+ choice_organization: "Your organization", choice_subscription: "Claude subscription",
15
+ antigravity: "Antigravity (console fallback)",
16
+ error: "Could not complete sign-in. Check status, retry, or sign in later.",
17
+ error_unsupported_prompt: "This CLI screen is not supported. Cancel and use the console fallback.",
18
+ error_cleanup_failed: "The login process could not be confirmed closed. Close it on the host and restart setup before retrying.",
19
+ error_signin_cleanup_failed: "The login process could not be confirmed closed. Close it on the host and restart setup before retrying.",
20
+ error_signin_action_stale: "That prompt changed or was already answered. Refresh its status; do not submit it again.",
21
+ error_signin_console_only: "This backend uses the explicit console fallback.",
22
+ error_backend_signin_local_only: "Backend sign-in is available only on this computer. Use the local setup page, or sign in later.",
23
+ error_signin_session_expired: "This setup session has ended. Reopen setup on the host.",
24
+ error_expired: "This login attempt expired. Start a new attempt.",
25
+ error_auth_unconfirmed: "The CLI exited, but credentials could not be verified. Retry or sign in later.",
26
+ error_provider_rejected: "The provider rejected this sign-in. Retry or sign in later.",
27
+ },
28
+ "zh-TW": {
29
+ heading: "登入你的 AI 後端",
30
+ lead: "用這裡的按鈕操作;Kiro、Claude Code 和 Codex 都不需要在終端機輸入。也可以之後再從儀表板登入。",
31
+ check: "檢查登入狀態", skipped: "稍後登入 · 會留在「等你回應」", valid: "已登入 ✓", notInstalled: "這台主機上沒有安裝",
32
+ consoleOnly: "請改用主控台備援,或稍後登入。", needed: "需要登入", waiting: "等待 CLI 回應…", login: "登入:{0}",
33
+ openProvider: "開啟登入頁", deviceCode: "裝置代碼:", answerSent: "已送出。等待下一個畫面;不會重複送出。",
34
+ cancel: "取消登入", signIn: "登入", signInAgain: "重新登入", later: "稍後登入", submit: "送出{0}",
35
+ relogin: "要重新登入嗎?Kiro 會先登出目前的帳號。", ready: "可以繼續設定了。",
36
+ field_code: "貼上取得的代碼", field_start_url: "組織的 Start URL", field_region: "AWS 區域",
37
+ phase_method: "選擇方式", phase_code: "代碼", phase_start_url: "Start URL", phase_region: "區域", phase_authorization: "授權",
38
+ choice_organization: "你的組織", choice_subscription: "Claude 訂閱",
39
+ antigravity: "Antigravity(主控台備援)",
40
+ error: "無法完成登入。請檢查狀態、重試,或稍後登入。",
41
+ error_unsupported_prompt: "不支援這個 CLI 畫面。請取消並改用主控台備援。",
42
+ error_cleanup_failed: "無法確認登入程序已關閉。請在主機上關閉它,並重新開始設定後再試。",
43
+ error_signin_cleanup_failed: "無法確認登入程序已關閉。請在主機上關閉它,並重新開始設定後再試。",
44
+ error_signin_action_stale: "這個畫面已改變或已回答過。請重新整理狀態,不要再送一次。",
45
+ error_signin_console_only: "這個後端使用主控台備援。",
46
+ error_backend_signin_local_only: "後端登入只能在這台電腦上進行。請使用本機的設定頁,或稍後登入。",
47
+ error_signin_session_expired: "這個設定工作階段已結束。請在主機上重新開啟設定。",
48
+ error_expired: "這次登入已過期。請重新開始。",
49
+ error_auth_unconfirmed: "CLI 已結束,但無法確認憑證。請重試或稍後登入。",
50
+ error_provider_rejected: "平台拒絕了這次登入。請重試或稍後登入。",
51
+ },
15
52
  };
53
+ const NAMES = { "kiro-cli": "Kiro", "claude-code": "Claude Code", codex: "Codex", antigravity: "Antigravity" };
54
+ const CHOICES = { builder_id: "Builder ID", google: "Google", github: "GitHub", organization: null, subscription: null, console: "Anthropic Console" };
55
+ /** The page's language, as its <html lang> says (the setup page and the dashboard both keep it current). */
56
+ const pageLang = doc => /^zh/i.test(doc?.documentElement?.lang || "") ? "zh-TW" : "en";
16
57
 
17
- export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, changed = () => {} } = {}) {
58
+ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, changed = () => {}, lang } = {}) {
18
59
  const doc = root.ownerDocument;
19
60
  let view = null, busy = false, disposed = false, timer = null, generation = 0, message = "", rendered = "";
61
+ const language = () => (lang ? lang() : pageLang(doc)) === "zh-TW" ? "zh-TW" : "en";
62
+ const tr = (key, value) => { const text = SIGNIN_STRINGS[language()][key] ?? SIGNIN_STRINGS.en[key] ?? key; return value === undefined ? text : text.split("{0}").join(value); };
20
63
  const el = (tag, text, parent = root) => { const node = doc.createElement(tag); if (text) node.textContent = text; parent.append(node); return node; };
21
- const errorText = code => ERRORS[code] || "Could not complete sign-in. Check status, retry, or sign in later.";
64
+ // An error is kept as its code, so it is said again in the other language when that changes.
65
+ const errorText = code => SIGNIN_STRINGS.en["error_" + code] ? tr("error_" + code) : tr("error");
66
+ const name = backend => backend === "antigravity" ? tr("antigravity") : NAMES[backend] || backend;
67
+ const choiceName = choice => CHOICES[choice] ?? tr("choice_" + choice);
68
+ const phaseName = phase => SIGNIN_STRINGS.en["phase_" + phase] ? tr("phase_" + phase) : phase.replaceAll("_", " ");
22
69
  const button = (parent, label, action) => { const b = el("button", label, parent); b.type = "button"; b.disabled = busy; b.onclick = action; return b; };
23
70
  const request = async data => {
24
71
  const response = await fetcher(endpoint, { method: data ? "POST" : "GET", cache: "no-store", headers: { "Content-Type": "application/json" }, ...(data ? { body: JSON.stringify(data) } : {}) });
@@ -31,64 +78,64 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
31
78
  if (busy || disposed) return;
32
79
  busy = true; generation++; message = ""; render();
33
80
  try { const next = await request(data); if (!disposed) accept(next); }
34
- catch (error) { if (!disposed) message = errorText(error?.message); }
81
+ catch (error) { if (!disposed) message = String(error?.message || "error"); }
35
82
  finally { busy = false; if (!disposed) render(); }
36
83
  }
37
84
  function render() {
38
- const signature = JSON.stringify([view, busy, message]);
85
+ const signature = JSON.stringify([view, busy, message, language()]);
39
86
  if (disposed || rendered === signature) return;
40
87
  rendered = signature; root.replaceChildren();
41
- el("h2", "Sign in your AI backends");
42
- el("p", "Use the controls here; no terminal typing is needed for Kiro, Claude Code or Codex. You can sign in later from the dashboard.");
43
- if (message) { const alert = el("p", message); alert.setAttribute("role", "alert"); }
44
- if (!view) { button(root, "Check sign-ins", () => perform({ operation: "refresh" })); return; }
88
+ el("h2", tr("heading"));
89
+ el("p", tr("lead"));
90
+ if (message) { const alert = el("p", errorText(message)); alert.setAttribute("role", "alert"); }
91
+ if (!view) { button(root, tr("check"), () => perform({ operation: "refresh" })); return; }
45
92
  for (const backend of view.selected) {
46
93
  const card = el("section"); card.dataset.backend = backend;
47
- el("h3", NAMES[backend] || backend, card);
94
+ el("h3", name(backend), card);
48
95
  const state = view.states[backend], pending = view.pending.includes(backend), skipped = view.skipped.includes(backend);
49
- el("p", skipped ? "Sign in later · remains in Needs you" : state === "valid" ? "Signed in ✓" : state === "not_installed" ? "Not installed on this host" : state === "console_only" ? "Use the explicit console fallback, or sign in later." : "Sign-in needed", card);
96
+ el("p", tr(skipped ? "skipped" : state === "valid" ? "valid" : state === "not_installed" ? "notInstalled" : state === "console_only" ? "consoleOnly" : "needed"), card);
50
97
  const login = view.login?.backend === backend ? view.login : null;
51
98
  const active = login && login.phase !== "done" && !(login.phase === "failed" && login.reason);
52
99
  if (active) {
53
- el("p", login.phase === "waiting" || login.phase === "starting" ? "Waiting for the CLI…" : "Login: " + login.phase.replaceAll("_", " "), card);
100
+ el("p", login.phase === "waiting" || login.phase === "starting" ? tr("waiting") : tr("login", phaseName(login.phase)), card);
54
101
  if (login.phase === "method" && login.canAct) for (const choice of login.choices || []) {
55
- if (CHOICES[choice]) button(card, CHOICES[choice], () => perform({ operation: "input", id: login.id, revision: login.revision, action: { kind: "method", choice } }));
102
+ if (Object.hasOwn(CHOICES, choice)) button(card, choiceName(choice), () => perform({ operation: "input", id: login.id, revision: login.revision, action: { kind: "method", choice } }));
56
103
  }
57
104
  if (login.url) {
58
105
  // The host already allowlists these; still never turn a non-HTTPS URL into a link.
59
106
  let url; try { url = new URL(login.url); } catch {}
60
107
  if (url?.protocol === "https:" && !url.username && !url.password) {
61
- const link = el("a", "Open provider sign-in", card); link.href = url.href; link.target = "_blank"; link.rel = "noopener noreferrer";
108
+ const link = el("a", tr("openProvider"), card); link.href = url.href; link.target = "_blank"; link.rel = "noopener noreferrer";
62
109
  }
63
110
  }
64
- if (login.code) { el("p", "Device code:", card); el("code", login.code, card); }
111
+ if (login.code) { el("p", tr("deviceCode"), card); el("code", login.code, card); }
65
112
  if (login.canAct && ["code", "start_url", "region"].includes(login.phase)) {
66
- const label = el("label", { code: "Paste the returned code", start_url: "Organization Start URL", region: "AWS region" }[login.phase], card);
113
+ const label = el("label", tr("field_" + login.phase), card);
67
114
  const input = el("input", null, label); input.type = login.phase === "code" ? "password" : "text"; input.autocomplete = "off"; input.spellcheck = false;
68
115
  input.setAttribute("aria-label", label.textContent); input.disabled = busy;
69
- button(card, "Submit " + login.phase.replaceAll("_", " "), () => { const value = input.value; input.value = ""; void perform({ operation: "input", id: login.id, revision: login.revision, action: { kind: login.phase, value } }); });
116
+ button(card, tr("submit", phaseName(login.phase)), () => { const value = input.value; input.value = ""; void perform({ operation: "input", id: login.id, revision: login.revision, action: { kind: login.phase, value } }); });
70
117
  }
71
- if (["method", "code", "start_url", "region"].includes(login.phase) && !login.canAct) el("p", "Answer sent. Waiting for the next screen; it will not be sent twice.", card);
72
- button(card, "Cancel sign-in", () => perform({ operation: "cancel" }));
118
+ if (["method", "code", "start_url", "region"].includes(login.phase) && !login.canAct) el("p", tr("answerSent"), card);
119
+ button(card, tr("cancel"), () => perform({ operation: "cancel" }));
73
120
  } else {
74
121
  if (login?.reason && login.reason !== "cancelled") el("p", errorText(login.reason), card);
75
122
  const usable = !["antigravity"].includes(backend) && state !== "not_installed";
76
- if (usable) button(card, state === "valid" ? "Sign in again" : "Sign in", () => {
123
+ if (usable) button(card, tr(state === "valid" ? "signInAgain" : "signIn"), () => {
77
124
  const relogin = state === "valid";
78
- if (relogin && !globalThis.confirm("Sign in again? Kiro will sign out its existing account first.")) return;
125
+ if (relogin && !globalThis.confirm(tr("relogin"))) return;
79
126
  void perform({ operation: "start", backend, relogin });
80
127
  });
81
128
  }
82
- if (pending && !skipped) button(card, "Sign in later", () => perform({ operation: "skip", backend }));
129
+ if (pending && !skipped) button(card, tr("later"), () => perform({ operation: "skip", backend }));
83
130
  }
84
- button(root, "Check sign-ins", () => perform({ operation: "refresh" }));
85
- if (view.ready) el("p", "You can continue setup.");
131
+ button(root, tr("check"), () => perform({ operation: "refresh" }));
132
+ if (view.ready) el("p", tr("ready"));
86
133
  }
87
134
  async function poll() {
88
135
  if (disposed) return;
89
136
  const before = generation;
90
137
  if (!busy) try { const next = await request(); if (!disposed && before === generation) { accept(next); render(); } }
91
- catch (error) { if (!disposed && before === generation) { message = errorText(error?.message); render(); } }
138
+ catch (error) { if (!disposed && before === generation) { message = String(error?.message || "error"); render(); } }
92
139
  if (!disposed) timer = setTimeout(poll, 1000);
93
140
  }
94
141
  render(); void poll();
@@ -98,6 +145,8 @@ export function mountStructuredSignIns(root, { endpoint, fetcher = fetch, change
98
145
  return perform({ operation: "select", backends: [...new Set([...view.selected, ...backends])] });
99
146
  },
100
147
  addBackend(backend) { if (view && NAMES[backend] && !view.selected.includes(backend)) return perform({ operation: "select", backends: [...view.selected, backend] }); },
148
+ /** Draw it again in the page's language now (it also follows on its next poll). */
149
+ relabel() { render(); },
101
150
  dispose() { disposed = true; generation++; clearTimeout(timer); root.replaceChildren(); },
102
151
  };
103
152
  }
@@ -111,5 +160,7 @@ if (setupRoot) {
111
160
  const observer = new MutationObserver(select); if (backend) observer.observe(backend, { childList: true });
112
161
  // Initial GET may finish after the environment list, so also observe our readiness result.
113
162
  const ready = new MutationObserver(select); ready.observe(setupRoot, { attributes: true, attributeFilter: ["data-ready"] });
114
- addEventListener("pagehide", () => { observer.disconnect(); ready.disconnect(); cards.dispose(); }, { once: true });
163
+ // #2726: the page's language toggle changes <html lang>; the cards follow at once.
164
+ const language = new MutationObserver(() => cards.relabel()); language.observe(document.documentElement, { attributes: true, attributeFilter: ["lang"] });
165
+ addEventListener("pagehide", () => { observer.disconnect(); ready.disconnect(); language.disconnect(); cards.dispose(); }, { once: true });
115
166
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@songsid/agend",
3
- "version": "2.3.2-beta.12",
3
+ "version": "2.3.2-beta.13",
4
4
  "description": "Multi-agent fleet daemon — run coding CLIs (Claude, Muse, Codex, OpenCode) from Discord or Telegram",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,7 +5,7 @@
5
5
  $WSL_COMMAND_FN = @'
6
6
  function Invoke-BoundedWsl {
7
7
  param([string[]]$Arguments, [int]$TimeoutSeconds=30)
8
- $sep=[array]::IndexOf($Arguments, '--')
8
+ $sep=[array]::IndexOf($Arguments, '--exec')
9
9
  if ($sep -ge 0 -and $Arguments.Length -gt ($sep + 1) -and $Arguments[$sep + 1] -eq 'bash') {
10
10
  $Arguments=@($Arguments[0..$sep]) + @('timeout', '--signal=TERM', '--kill-after=2s', [string]([Math]::Max(1, $TimeoutSeconds - 5))) + @($Arguments[($sep + 1)..($Arguments.Length - 1)])
11
11
  }
@@ -57,7 +57,7 @@ function Invoke-OpenDashboard([string]$distro, [string]$user = 'root', [switch]$
57
57
  $prevEAP = $ErrorActionPreference
58
58
  try {
59
59
  $ErrorActionPreference = 'Continue'
60
- $r = Invoke-BoundedWsl -Arguments @('-d', $distro, '-u', $user, '--', 'bash', '-lc', (Get-WslAgendCommand $command))
60
+ $r = Invoke-BoundedWsl -Arguments @('-d', $distro, '-u', $user, '--exec', 'bash', '-lc', (Get-WslAgendCommand $command))
61
61
  $text = $r.Text; $exit = $r.Code
62
62
  } catch {
63
63
  $text = "$_"; $exit = 1
@@ -94,7 +94,7 @@ function Invoke-AgendInWsl([string]$distro, [string]$user, [string]$command) {
94
94
  $ErrorActionPreference = 'Continue'
95
95
  try { [Console]::OutputEncoding = [Text.Encoding]::UTF8 } catch { }
96
96
  $limit = if ($command -match '^agend (restart|start)( |$)') { 360 } else { 30 }
97
- return (Invoke-BoundedWsl -TimeoutSeconds $limit -Arguments @('-d', $distro, '-u', $user, '--', 'bash', '-lc', (Get-WslAgendCommand $command)))
97
+ return (Invoke-BoundedWsl -TimeoutSeconds $limit -Arguments @('-d', $distro, '-u', $user, '--exec', 'bash', '-lc', (Get-WslAgendCommand $command)))
98
98
  } catch {
99
99
  return @{ Code = -1; Text = "$_" }
100
100
  } finally {