thinkpool-pair 0.7.10 → 0.7.11
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-session.mjs +13 -0
- package/package.json +1 -1
package/claude-session.mjs
CHANGED
|
@@ -162,6 +162,19 @@ export function startClaudeSession({ cwd, model, resume, mode: initialMode = 'de
|
|
|
162
162
|
// (deny → stay planning). On approval we flip the SDK permission mode so
|
|
163
163
|
// subsequent tools actually execute.
|
|
164
164
|
if (toolName === 'ExitPlanMode') {
|
|
165
|
+
// GUARANTEE: a plan card only ever appears when the room is ACTUALLY in Plan
|
|
166
|
+
// mode (the user pressed ⇧⇥ → Plan). If the agent reaches ExitPlanMode while
|
|
167
|
+
// the room is in any other mode (default / acceptEdits / bypassPermissions),
|
|
168
|
+
// it entered plan mode on its own — the user never asked. Don't surface an
|
|
169
|
+
// unsolicited "PLAN READY" card that blocks them; re-assert the room's real
|
|
170
|
+
// mode and let the work proceed. This is the backstop for plan-mode leaking
|
|
171
|
+
// in regardless of source (sticky localStorage, SDK default, a host-global
|
|
172
|
+
// brainstorm nudge): in a ThinkPool room, plan is opt-in, never imposed.
|
|
173
|
+
if (mode !== 'plan') {
|
|
174
|
+
scheduleSdkMode(mode) // snap the SDK back out of plan, into the real mode
|
|
175
|
+
emit({ kind: 'mode', mode }) // keep the room chip honest
|
|
176
|
+
return { continue: true, hookSpecificOutput: { hookEventName: 'PreToolUse', permissionDecision: 'allow', permissionDecisionReason: `The ThinkPool room is in ${mode} mode, not Plan — the user did not ask for a plan. Do NOT call ExitPlanMode; proceed and make the changes directly. Only present a plan if the user switches the room to Plan mode or explicitly asks.` } }
|
|
177
|
+
}
|
|
165
178
|
let choice = 'keep'
|
|
166
179
|
try { choice = await requestPermission?.({ id: randomUUID(), toolName, input: toolInput, risk: 'plan', plan: toolInput?.plan || '' }) ?? 'keep' }
|
|
167
180
|
catch { choice = 'keep' }
|