@galda/cli 0.10.57 → 0.10.58
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/engine/lib.mjs +1 -0
- package/engine/server.mjs +14 -1
- package/package.json +1 -1
package/engine/lib.mjs
CHANGED
|
@@ -2583,6 +2583,7 @@ export function workerPrompt(task, goal, lastFailure, agentName = 'claude-code')
|
|
|
2583
2583
|
// (research, summaries, answers) simply skip this — the worker decides,
|
|
2584
2584
|
// never us.
|
|
2585
2585
|
`- 人が実際に動かして結果を見られる依頼なら、最後にプロジェクト直下へ ${RUN_DECL_FILE} を書く: {"cmd": "<起動コマンド>", "url": "<開くURL>", "note": "<何が見えるか1行>", "check": "<人に何を見て判断してほしいか1行>", "title": "<この作業のチケット名。対象が分かる程度に説明的で動作を含む短い名前。例「看板モードの追加」「ヘッダのズレの修正」。依頼文をそのまま写さない>"}。Manager はこれを使って人に「動かして見る」と「何を見ればいいか」を出す。動かして見せるものが無い依頼(調査・要約・質問への回答など)では書かなくてよい。`,
|
|
2586
|
+
`- 「ローカルで見れない」というフィードバックには、ターミナル操作や npx の再実行を案内して終わらないこと。${RUN_DECL_FILE} を実際に開ける内容へ更新し、可能なら自分でURLへ接続確認してから完了すること。`,
|
|
2586
2587
|
// Links are rendered as links. The product cannot tell a real one from a
|
|
2587
2588
|
// decorative one, so the only place this can be held is here.
|
|
2588
2589
|
`- 自分が作っていない場所へのリンクを報告に書かない(存在しないURLや「詳しくはここ」のような飾りのリンクは、そのままリンクとして人に表示される)。`,
|
package/engine/server.mjs
CHANGED
|
@@ -2129,7 +2129,7 @@ async function startEphemeralApp(projectDir) {
|
|
|
2129
2129
|
try {
|
|
2130
2130
|
const key = readFileSync(join(home, 'secret.key'), 'utf8').trim();
|
|
2131
2131
|
const r = await fetch(`http://localhost:${port}/api/state?key=${key}`);
|
|
2132
|
-
if (r.ok) return { url: `http://localhost:${port}/?key=${key}`, kill: () => { try { child.kill(); } catch {} } };
|
|
2132
|
+
if (r.ok) return { url: `http://localhost:${port}/?key=${key}`, child, kill: () => { try { child.kill(); } catch {} } };
|
|
2133
2133
|
} catch { /* not up yet */ }
|
|
2134
2134
|
}
|
|
2135
2135
|
try { child.kill(); } catch {}
|
|
@@ -2259,6 +2259,19 @@ async function startPreview(task) {
|
|
|
2259
2259
|
live.expires = Date.now() + PREVIEW_IDLE_MS;
|
|
2260
2260
|
return { url: live.url, reused: true };
|
|
2261
2261
|
}
|
|
2262
|
+
// A Manager app cannot preview itself on its declared production port: that
|
|
2263
|
+
// port is already occupied, and its bare URL requires an access key. Boot the
|
|
2264
|
+
// edited checkout with isolated state and return its real key-bearing URL.
|
|
2265
|
+
let managerPackage = false;
|
|
2266
|
+
try { managerPackage = JSON.parse(readFileSync(join(dir, 'package.json'), 'utf8')).name === '@galda/cli'; } catch {}
|
|
2267
|
+
if (managerPackage && existsSync(join(dir, 'engine', 'server.mjs')) && existsSync(join(dir, 'app', 'index.html'))) {
|
|
2268
|
+
const eph = await startEphemeralApp(dir);
|
|
2269
|
+
if (!eph) throw new Error('Could not start the local preview. Please try again.');
|
|
2270
|
+
const entry = { proc: eph.child, url: eph.url, expires: Date.now() + PREVIEW_IDLE_MS };
|
|
2271
|
+
previews.set(task.id, entry);
|
|
2272
|
+
eph.child.on('close', () => { if (previews.get(task.id) === entry) previews.delete(task.id); });
|
|
2273
|
+
return { url: eph.url, reused: false, started: true };
|
|
2274
|
+
}
|
|
2262
2275
|
// Declared a URL but no command: the thing is already reachable (an app the
|
|
2263
2276
|
// worker left running, a hosted page). Nothing to start.
|
|
2264
2277
|
if (!cmd) return { url, reused: false, started: false };
|
package/package.json
CHANGED