@cocorograph/hub-agent 0.8.91 → 0.8.92
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/package.json +1 -1
- package/src/main.mjs +1 -0
- package/src/session-restore.mjs +14 -2
package/package.json
CHANGED
package/src/main.mjs
CHANGED
|
@@ -3116,6 +3116,7 @@ export async function dispatch(msg, ctx) {
|
|
|
3116
3116
|
runInLane: scheduler && ((lane, fn) => scheduler.runInLane(lane, fn)),
|
|
3117
3117
|
claudeBridge: ctx.claudeBridge,
|
|
3118
3118
|
codexBridge: ctx.codexBridge,
|
|
3119
|
+
claudeAttachOptions: () => resolveClaudeAttachOptions(ctx.config),
|
|
3119
3120
|
available: (kind) => kind === "codex"
|
|
3120
3121
|
? codexAvailableForDispatch(ctx)
|
|
3121
3122
|
: ctx.availableClis?.includes("claude") === true,
|
package/src/session-restore.mjs
CHANGED
|
@@ -7,6 +7,8 @@ import { WARM_TOTAL_MAX } from "./warm-bounds-total.mjs"
|
|
|
7
7
|
import { describeLiveSessionsUnion } from "./live-sessions.mjs"
|
|
8
8
|
import { attachLaneKey } from "./dispatch-scheduler.mjs"
|
|
9
9
|
|
|
10
|
+
const nonEmpty = (v) => (typeof v === "string" && v ? v : undefined)
|
|
11
|
+
|
|
10
12
|
/** 復元専用の購読は browser に存在しない。detach 後の遅延イベントも送信しない。 */
|
|
11
13
|
export function sendBridgeMessage(client, message) {
|
|
12
14
|
if (message.stream_id?.startsWith("restore:")) return
|
|
@@ -31,6 +33,7 @@ export function noteRestoreStop(state, cliKind, cwd) {
|
|
|
31
33
|
export async function restoreSessions(message, {
|
|
32
34
|
state, claudeBridge, codexBridge, available, logger,
|
|
33
35
|
runInLane = (_lane, fn) => fn(), statCwd = stat,
|
|
36
|
+
claudeAttachOptions = () => ({}),
|
|
34
37
|
}) {
|
|
35
38
|
if (state.accepted) {
|
|
36
39
|
logger?.info?.({}, "agent.sessions.restore ignored: already accepted")
|
|
@@ -107,9 +110,18 @@ export async function restoreSessions(message, {
|
|
|
107
110
|
try {
|
|
108
111
|
await bridge.attach({
|
|
109
112
|
stream_id, cwd: row.cwd,
|
|
113
|
+
// ⚠️ Claude は通常 attach と同じ既定 (agent.json の model / permissionMode 等) を渡す。
|
|
114
|
+
// 起動後の再接続は live 側の設定を優先し、bypassPermissions は起動時にしか入らないため、
|
|
115
|
+
// ここで欠けると復元した会話だけ権限モードが既定に落ちる (0.8.91 の実測)。
|
|
110
116
|
...(row.cli_kind === "claude"
|
|
111
|
-
? { resumeSessionId: row.session_id }
|
|
112
|
-
|
|
117
|
+
? { ...claudeAttachOptions(), resumeSessionId: row.session_id }
|
|
118
|
+
// Codex は承認ポリシー / サンドボックスを thread 開始時にしか受け取らない。Hub が
|
|
119
|
+
// Cockpit の既定を行に載せる (空なら載せない = config.toml 既定。通常 attach と同じ)。
|
|
120
|
+
: {
|
|
121
|
+
resumeThreadId: row.session_id,
|
|
122
|
+
approvalPolicy: nonEmpty(row.approval_policy),
|
|
123
|
+
sandbox: nonEmpty(row.sandbox),
|
|
124
|
+
}),
|
|
113
125
|
})
|
|
114
126
|
logger?.info?.({ cli_kind: row.cli_kind, cwd: row.cwd, session_id: row.session_id },
|
|
115
127
|
"agent.sessions.restore registered")
|