(
onDone: LocalJSXCommandOnDone,
context: ToolUseContext & LocalJSXCommandContext,
)
| 58 | load: () => |
| 59 | Promise.resolve({ |
| 60 | async call( |
| 61 | onDone: LocalJSXCommandOnDone, |
| 62 | context: ToolUseContext & LocalJSXCommandContext, |
| 63 | ): Promise<React.ReactNode> { |
| 64 | const current = context.getAppState().isBriefOnly |
| 65 | const newState = !current |
| 66 | |
| 67 | // Entitlement check only gates the on-transition — off is always |
| 68 | // allowed so a user whose GB gate flipped mid-session isn't stuck. |
| 69 | if (newState && !isBriefEntitled()) { |
| 70 | logEvent('tengu_brief_mode_toggled', { |
| 71 | enabled: false, |
| 72 | gated: true, |
| 73 | source: |
| 74 | 'slash_command' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 75 | }) |
| 76 | onDone('Brief tool is not enabled for your account', { |
| 77 | display: 'system', |
| 78 | }) |
| 79 | return null |
| 80 | } |
| 81 | |
| 82 | // Two-way: userMsgOptIn tracks isBriefOnly so the tool is available |
| 83 | // exactly when brief mode is on. This invalidates prompt cache on |
| 84 | // each toggle (tool list changes), but a stale tool list is worse — |
| 85 | // when /brief is enabled mid-session the model was previously left |
| 86 | // without the tool, emitting plain text the filter hides. |
| 87 | setUserMsgOptIn(newState) |
| 88 | |
| 89 | context.setAppState(prev => { |
| 90 | if (prev.isBriefOnly === newState) return prev |
| 91 | return { ...prev, isBriefOnly: newState } |
| 92 | }) |
| 93 | |
| 94 | logEvent('tengu_brief_mode_toggled', { |
| 95 | enabled: newState, |
| 96 | gated: false, |
| 97 | source: |
| 98 | 'slash_command' as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS, |
| 99 | }) |
| 100 | |
| 101 | // The tool list change alone isn't a strong enough signal mid-session |
| 102 | // (model may keep emitting plain text from inertia, or keep calling a |
| 103 | // tool that just vanished). Inject an explicit reminder into the next |
| 104 | // turn's context so the transition is unambiguous. |
| 105 | // Skip when Kairos is active: isBriefEnabled() short-circuits on |
| 106 | // getKairosActive() so the tool never actually leaves the list, and |
| 107 | // the Kairos system prompt already mandates SendUserMessage. |
| 108 | // Inline <system-reminder> wrap — importing wrapInSystemReminder from |
| 109 | // utils/messages.ts pulls constants/xml.ts into the bridge SDK bundle |
| 110 | // via this module's import chain, tripping the excluded-strings check. |
| 111 | const metaMessages = getKairosActive() |
| 112 | ? undefined |
| 113 | : [ |
| 114 | `<system-reminder>\n${ |
| 115 | newState |
| 116 | ? `Brief mode is now enabled. Use the ${BRIEF_TOOL_NAME} tool for all user-facing output — plain text outside it is hidden from the user's view.` |
| 117 | : `Brief mode is now disabled. The ${BRIEF_TOOL_NAME} tool is no longer available — reply with plain text.` |
nothing calls this directly
no test coverage detected