(options: unknown)
| 4620 | } |
| 4621 | } |
| 4622 | function maybeActivateBrief(options: unknown): void { |
| 4623 | if (!(feature('KAIROS') || feature('KAIROS_BRIEF'))) return; |
| 4624 | const briefFlag = (options as { |
| 4625 | brief?: boolean; |
| 4626 | }).brief; |
| 4627 | const briefEnv = isEnvTruthy(process.env.CLAUDE_CODE_BRIEF); |
| 4628 | if (!briefFlag && !briefEnv) return; |
| 4629 | // --brief / CLAUDE_CODE_BRIEF are explicit opt-ins: check entitlement, |
| 4630 | // then set userMsgOptIn to activate the tool + prompt section. The env |
| 4631 | // var also grants entitlement (isBriefEntitled() reads it), so setting |
| 4632 | // CLAUDE_CODE_BRIEF=1 alone force-enables for dev/testing — no GB gate |
| 4633 | // needed. initialIsBriefOnly reads getUserMsgOptIn() directly. |
| 4634 | // Conditional require: static import would leak the tool name string |
| 4635 | // into external builds via BriefTool.ts → prompt.ts. |
| 4636 | /* eslint-disable @typescript-eslint/no-require-imports */ |
| 4637 | const { |
| 4638 | isBriefEntitled |
| 4639 | } = require('./tools/BriefTool/BriefTool.js') as typeof import('./tools/BriefTool/BriefTool.js'); |
| 4640 | /* eslint-enable @typescript-eslint/no-require-imports */ |
| 4641 | const entitled = isBriefEntitled(); |
| 4642 | if (entitled) { |
| 4643 | setUserMsgOptIn(true); |
| 4644 | } |
| 4645 | // Fire unconditionally once intent is seen: enabled=false captures the |
| 4646 | // "user tried but was gated" failure mode in Datadog. |
| 4647 | logEvent('tengu_brief_mode_enabled', { |
| 4648 | enabled: entitled, |
| 4649 | gated: !entitled, |
| 4650 | source: (briefEnv ? 'env' : 'flag') as AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS |
| 4651 | }); |
| 4652 | } |
| 4653 | function resetCursor() { |
| 4654 | const terminal = process.stderr.isTTY ? process.stderr : process.stdout.isTTY ? process.stdout : undefined; |
| 4655 | terminal?.write(SHOW_CURSOR); |
no test coverage detected