@galda/cli 0.10.20 → 0.10.21
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.
- package/CLAUDE.md +2 -1
- package/app/index.html +24 -1
- package/engine/lib.mjs +16 -0
- package/package.json +1 -1
package/CLAUDE.md
CHANGED
|
@@ -77,8 +77,9 @@
|
|
|
77
77
|
|
|
78
78
|
## relay接続(`app.galda.app`)を伴う作業の掟(Masa明言 2026-07-17・全レーン必読)
|
|
79
79
|
|
|
80
|
-
- **relayは1アカウント=同時1接続のみ**。同じ`MANAGER_HOME`(既定`~/.manager-for-ai`)を指す2つ目のプロセスを起動すると、実本番アカウントの接続を奪い合い、"無限ループ"(app.galda.appのリロード連打)を引き起こす。**
|
|
80
|
+
- **relayは1アカウント=同時1接続のみ**。同じ`MANAGER_HOME`(既定`~/.manager-for-ai`)を指す2つ目のプロセスを起動すると、実本番アカウントの接続を奪い合い、"無限ループ"(app.galda.appのリロード連打)を引き起こす。**6回繰り返した実績のあるインシデントクラス**(`docs/RUNBOOK-relay-mutual-kick.md`参照)。
|
|
81
81
|
- `engine/relay-client.mjs`は2026-07-17からPIDロックで2つ目の起動を自動拒否するが、**手動検証で`node engine/relay-client.mjs`や`npx @galda/cli`を叩く時は、必ず隔離した`MANAGER_HOME`を使う**(本番の`~/.manager-for-ai`を素で使わない)。
|
|
82
|
+
- **"無限ループ"に見えても原因は2系統ある**(プロセスが1個だけの時は相互kickではない=**アカウント不一致**。ローカルのライセンスemailとブラウザのGoogleサインインemailが違うと、プロセスは正常なのに永遠に「未接続」に見える)。`docs/RUNBOOK-relay-mutual-kick.md`の「診断の分岐」でプロセス数を数えてから対応を選ぶ。
|
|
82
83
|
- 「無限ループが起きてる」と報告されたら、コードを読みに行く前に**必ず**`docs/RUNBOOK-relay-mutual-kick.md`の診断手順(`ps aux | grep relay-client`から)に従う。
|
|
83
84
|
|
|
84
85
|
## 構成
|
package/app/index.html
CHANGED
|
@@ -6057,8 +6057,16 @@ function bootDisconnected(info){
|
|
|
6057
6057
|
#connectGate .cg-hint a:hover{text-decoration:underline}
|
|
6058
6058
|
#connectGate .cg-who{font-size:12px;color:var(--ink3,#6b6862);margin:0 0 4px}
|
|
6059
6059
|
#connectGate .cg-who b{color:var(--ink2,#a3a097)}
|
|
6060
|
-
#connectGate .cg-switch{font-size:12px;color:var(--ink3,#6b6862);margin:14px 0 0}
|
|
6060
|
+
#connectGate .cg-switch{font-size:12px;color:var(--ink3,#6b6862);margin:14px 0 0;transition:color .2s}
|
|
6061
6061
|
#connectGate .cg-switch a{color:var(--blue,#8fb0ff);text-decoration:none}
|
|
6062
|
+
/* A long wait (15s+) almost always means an account mismatch, not a slow
|
|
6063
|
+
first connect (Masa 2026-07-17: kept re-running npx, kept landing back
|
|
6064
|
+
here — the always-on caption below was too easy to miss). Escalate to
|
|
6065
|
+
the existing warning tone (--amber, same as failed-step/review chips)
|
|
6066
|
+
— color only, no filled box, per the hover/attention convention used
|
|
6067
|
+
everywhere else in this app. */
|
|
6068
|
+
#connectGate .cg-switch.escalated{color:var(--amber);font-weight:600}
|
|
6069
|
+
#connectGate .cg-switch.escalated a{color:var(--amber);text-decoration:underline}
|
|
6062
6070
|
#connectGate .cg-x{position:absolute;top:14px;right:16px;width:28px;height:28px;border:0;background:transparent;color:var(--ink3,#6b6862);font-size:20px;line-height:1;cursor:pointer}
|
|
6063
6071
|
#connectGate .cg-wait{display:inline-flex;align-items:center;gap:7px;font:500 10.5px/1 var(--mono,monospace);letter-spacing:.08em;color:var(--ink3,#6b6862);margin-top:16px}
|
|
6064
6072
|
#connectGate .cg-wait i{width:6px;height:6px;border-radius:50%;background:var(--green,#3DDC97);animation:cgpulse 1.8s ease-in-out infinite}
|
|
@@ -6111,11 +6119,26 @@ function bootDisconnected(info){
|
|
|
6111
6119
|
// `setInterval` + `if (status !== 503) reload` poll, which amplified any agent
|
|
6112
6120
|
// flap into an infinite reload (the ~10-failure "無限ループ").
|
|
6113
6121
|
const cgWait = ov.querySelector('.cg-wait');
|
|
6122
|
+
const cgSwitch = ov.querySelector('.cg-switch');
|
|
6123
|
+
// Escalate the account-mismatch hint after a long wait (2026-07-17: mirrors
|
|
6124
|
+
// engine/lib.mjs shouldEscalateConnectGateHint — inlined, this file can't
|
|
6125
|
+
// import engine/lib.mjs). A genuine first connect takes a few seconds; a
|
|
6126
|
+
// wait that crosses 15s is almost always the local agent being signed in
|
|
6127
|
+
// under a DIFFERENT email than this browser (relay identity is per-email,
|
|
6128
|
+
// so re-running `npx @galda/cli` — which reconnects that SAME mismatched
|
|
6129
|
+
// identity — never helps; only `--signin` does). Naming the actual signed-
|
|
6130
|
+
// in email turns "I have no idea what's wrong" into "oh, wrong account".
|
|
6131
|
+
const CG_ESCALATE_MS = 15000;
|
|
6132
|
+
const escalateTimer = (email && cgSwitch) ? setTimeout(() => {
|
|
6133
|
+
cgSwitch.classList.add('escalated');
|
|
6134
|
+
cgSwitch.innerHTML = `Still waiting? Galda may already be running on this computer under a <b>different account</b> than <b>${email.replace(/[<>&]/g, (c) => ({ '<': '<', '>': '>', '&': '&' }[c]))}</b>. Run <code>npx @galda/cli --signin</code> in that terminal and pick this account. Or <a href="/logout">switch this browser →</a>`;
|
|
6135
|
+
}, CG_ESCALATE_MS) : null;
|
|
6114
6136
|
try {
|
|
6115
6137
|
const es = new EventSource('/presence');
|
|
6116
6138
|
es.addEventListener('presence', (e) => {
|
|
6117
6139
|
let d; try { d = JSON.parse(e.data); } catch { return; }
|
|
6118
6140
|
if (d.state === 'connected') {
|
|
6141
|
+
if (escalateTimer) clearTimeout(escalateTimer);
|
|
6119
6142
|
// Confirm the engine is REALLY reachable before reloading. A stale/spurious
|
|
6120
6143
|
// 'connected' presence otherwise reloads us into a white flash that lands
|
|
6121
6144
|
// right back on this same connect screen — the welcome animation plays, then
|
package/engine/lib.mjs
CHANGED
|
@@ -3134,3 +3134,19 @@ export function shouldRefuseRelayClientStart({ existingLock, alive } = {}) {
|
|
|
3134
3134
|
if (!alive) return { refuse: false, reason: 'stale-lock' };
|
|
3135
3135
|
return { refuse: true, reason: 'already-running', holderPid: existingLock.pid };
|
|
3136
3136
|
}
|
|
3137
|
+
|
|
3138
|
+
// --- Connect-gate account-mismatch escalation (2026-07-17) ------------------
|
|
3139
|
+
// A genuinely fresh "run npx @galda/cli" wait is short — the agent connects
|
|
3140
|
+
// within a few seconds. A wait that runs long almost always means one thing:
|
|
3141
|
+
// the local agent IS running, but it's licensed under a DIFFERENT email than
|
|
3142
|
+
// the one signed in on this browser (relay identity is per-email, so they
|
|
3143
|
+
// never meet). Before this, the only guidance for that exact scenario was a
|
|
3144
|
+
// small always-on caption easy to miss among the first-time-setup copy — a
|
|
3145
|
+
// user just re-runs `npx @galda/cli` (which reconnects the SAME already-
|
|
3146
|
+
// mismatched identity) and waits again, forever. Escalating the hint once the
|
|
3147
|
+
// wait crosses a threshold — with the actual signed-in email substituted in —
|
|
3148
|
+
// turns "I have no idea what's wrong" into "oh, wrong account" (see
|
|
3149
|
+
// docs/RUNBOOK-relay-mutual-kick.md's account-mismatch entry).
|
|
3150
|
+
export function shouldEscalateConnectGateHint(waitedMs, email, thresholdMs = 15000) {
|
|
3151
|
+
return Number(waitedMs) >= thresholdMs && Boolean(String(email ?? '').trim());
|
|
3152
|
+
}
|
package/package.json
CHANGED