bingocode 1.1.143 → 1.1.145
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/settings.local.json +24 -1
- package/bin/bingo-win.cjs +17 -21
- package/bin/bingocode-win.cjs +18 -22
- package/bin/claude-win.cjs +18 -21
- package/package.json +1 -1
- package/scripts/build-auto-mode.ts +86 -0
- package/src/cli/print.ts +3 -3
- package/src/cli/structuredIO.ts +2 -2
- package/src/commands/login/login.tsx +2 -2
- package/src/components/PromptInput/PromptInput.tsx +7 -7
- package/src/components/Settings/Config.tsx +6 -6
- package/src/components/messages/UserToolResultMessage/UserToolSuccessMessage.tsx +3 -3
- package/src/components/permissions/BashPermissionRequest/BashPermissionRequest.tsx +10 -10
- package/src/components/permissions/ExitPlanModePermissionRequest/ExitPlanModePermissionRequest.tsx +10 -10
- package/src/components/permissions/PermissionDecisionDebugInfo.tsx +2 -2
- package/src/components/permissions/PermissionRuleExplanation.tsx +2 -2
- package/src/components/permissions/hooks.ts +2 -2
- package/src/constants/betas.ts +2 -2
- package/src/hooks/notifs/useAutoModeUnavailableNotification.ts +2 -2
- package/src/hooks/toolPermission/PermissionContext.ts +3 -3
- package/src/hooks/toolPermission/handlers/coordinatorHandler.ts +2 -2
- package/src/hooks/toolPermission/handlers/interactiveHandler.ts +6 -6
- package/src/hooks/toolPermission/handlers/swarmWorkerHandler.ts +2 -2
- package/src/hooks/toolPermission/permissionLogging.ts +3 -3
- package/src/hooks/useReplBridge.tsx +2 -2
- package/src/interactiveHelpers.tsx +2 -2
- package/src/main.tsx +8 -8
- package/src/migrations/resetAutoModeOptInForDefaultOffer.ts +2 -2
- package/src/screens/REPL.tsx +4 -4
- package/src/server/ensureSingletonLocalServer.ts +18 -26
- package/src/services/api/claude.ts +4 -4
- package/src/services/api/withRetry.ts +2 -2
- package/src/services/tools/toolExecution.ts +2 -2
- package/src/tools/AgentTool/AgentTool.tsx +3 -3
- package/src/tools/AgentTool/agentToolUtils.ts +3 -3
- package/src/tools/AgentTool/runAgent.ts +2 -2
- package/src/tools/BashTool/bashPermissions.ts +17 -17
- package/src/tools/BashTool/pathValidation.ts +2 -2
- package/src/tools/ConfigTool/supportedSettings.ts +2 -2
- package/src/tools/ExitPlanModeTool/ExitPlanModeV2Tool.ts +5 -5
- package/src/tools/NotebookEditTool/NotebookEditTool.ts +2 -2
- package/src/types/permissions.ts +2 -2
- package/src/utils/attachments.ts +3 -3
- package/src/utils/autoModeDenials.ts +2 -2
- package/src/utils/betas.ts +2 -2
- package/src/utils/classifierApprovals.ts +7 -7
- package/src/utils/messages.ts +2 -2
- package/src/utils/permissions/PermissionMode.ts +2 -2
- package/src/utils/permissions/autoModeState.ts +2 -2
- package/src/utils/permissions/bypassPermissionsKillswitch.ts +2 -2
- package/src/utils/permissions/getNextPermissionMode.ts +2 -2
- package/src/utils/permissions/permissionSetup.ts +13 -13
- package/src/utils/permissions/permissions.ts +6 -6
- package/src/utils/permissions/yoloClassifier.ts +5 -5
- package/src/utils/settings/settings.ts +5 -5
- package/src/utils/settings/types.ts +4 -4
- package/src/utils/swarm/inProcessRunner.ts +2 -2
- package/src/utils/toolResultStorage.ts +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import { APIUserAbortError } from '@anthropic-ai/sdk'
|
|
3
3
|
import type { z } from 'zod/v4'
|
|
4
4
|
import { getFeatureValue_CACHED_MAY_BE_STALE } from '../../services/analytics/growthbook.js'
|
|
@@ -81,7 +81,7 @@ import { shouldUseSandbox } from './shouldUseSandbox.js'
|
|
|
81
81
|
// DCE cliff: Bun's feature() evaluator has a per-function complexity budget.
|
|
82
82
|
// bashToolHasPermission is right at the limit. `import { X as Y }` aliases
|
|
83
83
|
// inside the import block count toward this budget; when they push it over
|
|
84
|
-
// the threshold Bun can no longer prove
|
|
84
|
+
// the threshold Bun can no longer prove true is a
|
|
85
85
|
// constant and silently evaluates the ternaries to `false`, dropping every
|
|
86
86
|
// pendingClassifierCheck spread. Keep aliases as top-level const rebindings
|
|
87
87
|
// instead. (See also the comment on checkSemanticsDeny below.)
|
|
@@ -628,7 +628,7 @@ const TIMEOUT_FLAG_VALUE_RE = /^[A-Za-z0-9_.+-]+$/
|
|
|
628
628
|
*
|
|
629
629
|
* Extracted from stripWrappersFromArgv to keep bashToolHasPermission under
|
|
630
630
|
* Bun's feature() DCE complexity threshold — inlining this breaks
|
|
631
|
-
*
|
|
631
|
+
* true evaluation in classifier tests.
|
|
632
632
|
*/
|
|
633
633
|
function skipTimeoutFlags(a: readonly string[]): number {
|
|
634
634
|
let i = 1
|
|
@@ -1426,7 +1426,7 @@ function checkEarlyExitDeny(
|
|
|
1426
1426
|
* Separate helper (not folded into checkEarlyExitDeny or inlined at the call
|
|
1427
1427
|
* site) because bashToolHasPermission is tight against Bun's feature() DCE
|
|
1428
1428
|
* complexity threshold — adding even ~5 lines there breaks
|
|
1429
|
-
*
|
|
1429
|
+
* true evaluation and drops pendingClassifierCheck.
|
|
1430
1430
|
*/
|
|
1431
1431
|
function checkSemanticsDeny(
|
|
1432
1432
|
input: z.infer<typeof BashTool.inputSchema>,
|
|
@@ -1464,7 +1464,7 @@ function buildPendingClassifierCheck(
|
|
|
1464
1464
|
return undefined
|
|
1465
1465
|
}
|
|
1466
1466
|
// Skip in auto mode - auto mode classifier handles all permission decisions
|
|
1467
|
-
if (
|
|
1467
|
+
if (true && toolPermissionContext.mode === 'auto')
|
|
1468
1468
|
return undefined
|
|
1469
1469
|
if (toolPermissionContext.mode === 'bypassPermissions') return undefined
|
|
1470
1470
|
|
|
@@ -1502,7 +1502,7 @@ export function startSpeculativeClassifierCheck(
|
|
|
1502
1502
|
): boolean {
|
|
1503
1503
|
// Same guards as buildPendingClassifierCheck
|
|
1504
1504
|
if (!isClassifierPermissionsEnabled()) return false
|
|
1505
|
-
if (
|
|
1505
|
+
if (true && toolPermissionContext.mode === 'auto')
|
|
1506
1506
|
return false
|
|
1507
1507
|
if (toolPermissionContext.mode === 'bypassPermissions') return false
|
|
1508
1508
|
const allowDescriptions = getBashPromptAllowDescriptions(
|
|
@@ -1573,7 +1573,7 @@ export async function awaitClassifierAutoApproval(
|
|
|
1573
1573
|
logClassifierResultForAnts(command, 'allow', descriptions, classifierResult)
|
|
1574
1574
|
|
|
1575
1575
|
if (
|
|
1576
|
-
|
|
1576
|
+
true &&
|
|
1577
1577
|
classifierResult.matches &&
|
|
1578
1578
|
classifierResult.confidence === 'high'
|
|
1579
1579
|
) {
|
|
@@ -1642,7 +1642,7 @@ export async function executeAsyncClassifierCheck(
|
|
|
1642
1642
|
if (!callbacks.shouldContinue()) return
|
|
1643
1643
|
|
|
1644
1644
|
if (
|
|
1645
|
-
|
|
1645
|
+
true &&
|
|
1646
1646
|
classifierResult.matches &&
|
|
1647
1647
|
classifierResult.confidence === 'high'
|
|
1648
1648
|
) {
|
|
@@ -1757,7 +1757,7 @@ export async function bashToolHasPermission(
|
|
|
1757
1757
|
decisionReason,
|
|
1758
1758
|
message: createPermissionRequestMessage(BashTool.name, decisionReason),
|
|
1759
1759
|
suggestions: [],
|
|
1760
|
-
...(
|
|
1760
|
+
...(true
|
|
1761
1761
|
? {
|
|
1762
1762
|
pendingClassifierCheck: buildPendingClassifierCheck(
|
|
1763
1763
|
input.command,
|
|
@@ -1859,7 +1859,7 @@ export async function bashToolHasPermission(
|
|
|
1859
1859
|
if (
|
|
1860
1860
|
isClassifierPermissionsEnabled() &&
|
|
1861
1861
|
!(
|
|
1862
|
-
|
|
1862
|
+
true &&
|
|
1863
1863
|
appState.toolPermissionContext.mode === 'auto'
|
|
1864
1864
|
)
|
|
1865
1865
|
) {
|
|
@@ -1957,7 +1957,7 @@ export async function bashToolHasPermission(
|
|
|
1957
1957
|
reason: `Required by Bash prompt rule: "${askResult.matchedDescription}"`,
|
|
1958
1958
|
},
|
|
1959
1959
|
suggestions,
|
|
1960
|
-
...(
|
|
1960
|
+
...(true
|
|
1961
1961
|
? {
|
|
1962
1962
|
pendingClassifierCheck: buildPendingClassifierCheck(
|
|
1963
1963
|
input.command,
|
|
@@ -2024,7 +2024,7 @@ export async function bashToolHasPermission(
|
|
|
2024
2024
|
safetyResult.message ??
|
|
2025
2025
|
'Command contains patterns that require approval',
|
|
2026
2026
|
},
|
|
2027
|
-
...(
|
|
2027
|
+
...(true
|
|
2028
2028
|
? {
|
|
2029
2029
|
pendingClassifierCheck: buildPendingClassifierCheck(
|
|
2030
2030
|
input.command,
|
|
@@ -2061,7 +2061,7 @@ export async function bashToolHasPermission(
|
|
|
2061
2061
|
appState = context.getAppState()
|
|
2062
2062
|
return {
|
|
2063
2063
|
...commandOperatorResult,
|
|
2064
|
-
...(
|
|
2064
|
+
...(true
|
|
2065
2065
|
? {
|
|
2066
2066
|
pendingClassifierCheck: buildPendingClassifierCheck(
|
|
2067
2067
|
input.command,
|
|
@@ -2128,7 +2128,7 @@ export async function bashToolHasPermission(
|
|
|
2128
2128
|
),
|
|
2129
2129
|
decisionReason,
|
|
2130
2130
|
suggestions: [], // Don't suggest saving a potentially dangerous command
|
|
2131
|
-
...(
|
|
2131
|
+
...(true
|
|
2132
2132
|
? {
|
|
2133
2133
|
pendingClassifierCheck: buildPendingClassifierCheck(
|
|
2134
2134
|
input.command,
|
|
@@ -2319,7 +2319,7 @@ export async function bashToolHasPermission(
|
|
|
2319
2319
|
if (askSubresult !== undefined && nonAllowCount === 1) {
|
|
2320
2320
|
return {
|
|
2321
2321
|
...askSubresult,
|
|
2322
|
-
...(
|
|
2322
|
+
...(true
|
|
2323
2323
|
? {
|
|
2324
2324
|
pendingClassifierCheck: buildPendingClassifierCheck(
|
|
2325
2325
|
input.command,
|
|
@@ -2418,7 +2418,7 @@ export async function bashToolHasPermission(
|
|
|
2418
2418
|
if (result.behavior === 'ask' || result.behavior === 'passthrough') {
|
|
2419
2419
|
return {
|
|
2420
2420
|
...result,
|
|
2421
|
-
...(
|
|
2421
|
+
...(true
|
|
2422
2422
|
? {
|
|
2423
2423
|
pendingClassifierCheck: buildPendingClassifierCheck(
|
|
2424
2424
|
input.command,
|
|
@@ -2545,7 +2545,7 @@ export async function bashToolHasPermission(
|
|
|
2545
2545
|
message: createPermissionRequestMessage(BashTool.name, decisionReason),
|
|
2546
2546
|
decisionReason,
|
|
2547
2547
|
suggestions: suggestedUpdates,
|
|
2548
|
-
...(
|
|
2548
|
+
...(true
|
|
2549
2549
|
? {
|
|
2550
2550
|
pendingClassifierCheck: buildPendingClassifierCheck(
|
|
2551
2551
|
input.command,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { homedir } from 'os'
|
|
1
|
+
import { homedir } from 'os'
|
|
2
2
|
import { isAbsolute, resolve } from 'path'
|
|
3
3
|
import type { z } from 'zod/v4'
|
|
4
4
|
import type { ToolPermissionContext } from '../../Tool.js'
|
|
@@ -1156,7 +1156,7 @@ function astRedirectsToOutputRedirections(redirects: Redirect[]): {
|
|
|
1156
1156
|
// exports an older narrower copy (timeout/nice-n-N only) that is DEAD CODE
|
|
1157
1157
|
// — no prod consumer — but CANNOT be removed: bashPermissions.ts is right
|
|
1158
1158
|
// at Bun's feature() DCE complexity threshold, and deleting ~80 lines from
|
|
1159
|
-
// that module silently breaks
|
|
1159
|
+
// that module silently breaks true evaluation (drops
|
|
1160
1160
|
// every pendingClassifierCheck spread). Verified in PR #21503 round 3:
|
|
1161
1161
|
// baseline classifier tests 30/30 pass, after deletion 22/30 fail. See
|
|
1162
1162
|
// team memory: bun-feature-dce-cliff.md. Hit 3× in PR #21075 + twice in
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import { getRemoteControlAtStartup } from '../../utils/config.js'
|
|
3
3
|
import {
|
|
4
4
|
EDITOR_MODES,
|
|
@@ -114,7 +114,7 @@ export const SUPPORTED_SETTINGS: Record<string, SettingConfig> = {
|
|
|
114
114
|
source: 'settings',
|
|
115
115
|
type: 'string',
|
|
116
116
|
description: 'Default permission mode for tool usage',
|
|
117
|
-
options:
|
|
117
|
+
options: true
|
|
118
118
|
? ['default', 'plan', 'acceptEdits', 'dontAsk', 'auto']
|
|
119
119
|
: ['default', 'plan', 'acceptEdits', 'dontAsk'],
|
|
120
120
|
},
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import { writeFile } from 'fs/promises'
|
|
3
3
|
import { z } from 'zod/v4'
|
|
4
4
|
import {
|
|
@@ -49,10 +49,10 @@ import {
|
|
|
49
49
|
} from './UI.js'
|
|
50
50
|
|
|
51
51
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
52
|
-
const autoModeStateModule =
|
|
52
|
+
const autoModeStateModule = true
|
|
53
53
|
? (require('../../utils/permissions/autoModeState.js') as typeof import('../../utils/permissions/autoModeState.js'))
|
|
54
54
|
: null
|
|
55
|
-
const permissionSetupModule =
|
|
55
|
+
const permissionSetupModule = true
|
|
56
56
|
? (require('../../utils/permissions/permissionSetup.js') as typeof import('../../utils/permissions/permissionSetup.js'))
|
|
57
57
|
: null
|
|
58
58
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
@@ -325,7 +325,7 @@ export const ExitPlanModeV2Tool: Tool<InputSchema, Output> = buildTool({
|
|
|
325
325
|
// 'default' instead. Without this, ExitPlanMode would bypass the circuit
|
|
326
326
|
// breaker by calling setAutoModeActive(true) directly.
|
|
327
327
|
let gateFallbackNotification: string | null = null
|
|
328
|
-
if (
|
|
328
|
+
if (true) {
|
|
329
329
|
const prePlanRaw = appState.toolPermissionContext.prePlanMode ?? 'default'
|
|
330
330
|
if (
|
|
331
331
|
prePlanRaw === 'auto' &&
|
|
@@ -359,7 +359,7 @@ export const ExitPlanModeV2Tool: Tool<InputSchema, Output> = buildTool({
|
|
|
359
359
|
setHasExitedPlanMode(true)
|
|
360
360
|
setNeedsPlanModeExitAttachment(true)
|
|
361
361
|
let restoreMode = prev.toolPermissionContext.prePlanMode ?? 'default'
|
|
362
|
-
if (
|
|
362
|
+
if (true) {
|
|
363
363
|
if (
|
|
364
364
|
restoreMode === 'auto' &&
|
|
365
365
|
!(permissionSetupModule?.isAutoModeGateEnabled() ?? false)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import { extname, isAbsolute, resolve } from 'path'
|
|
3
3
|
import {
|
|
4
4
|
fileHistoryEnabled,
|
|
@@ -113,7 +113,7 @@ export const NotebookEditTool = buildTool({
|
|
|
113
113
|
return outputSchema()
|
|
114
114
|
},
|
|
115
115
|
toAutoClassifierInput(input) {
|
|
116
|
-
if (
|
|
116
|
+
if (true) {
|
|
117
117
|
const mode = input.edit_mode ?? 'replace'
|
|
118
118
|
return `${input.notebook_path} ${mode}: ${input.new_source}`
|
|
119
119
|
}
|
package/src/types/permissions.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
2
|
* Pure permission type definitions extracted to break import cycles.
|
|
3
3
|
*
|
|
4
4
|
* This file contains only type definitions and constants with no runtime dependencies.
|
|
@@ -32,7 +32,7 @@ export type PermissionMode = InternalPermissionMode
|
|
|
32
32
|
// defaultMode, --permission-mode CLI flag, conversation recovery).
|
|
33
33
|
export const INTERNAL_PERMISSION_MODES = [
|
|
34
34
|
...EXTERNAL_PERMISSION_MODES,
|
|
35
|
-
...(
|
|
35
|
+
...(true ? (['auto'] as const) : ([] as const)),
|
|
36
36
|
] as const satisfies readonly PermissionMode[]
|
|
37
37
|
|
|
38
38
|
export const PERMISSION_MODES = INTERNAL_PERMISSION_MODES
|
package/src/utils/attachments.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// biome-ignore-all assist/source/organizeImports: ANT-ONLY import markers must not be reordered
|
|
1
|
+
// biome-ignore-all assist/source/organizeImports: ANT-ONLY import markers must not be reordered
|
|
2
2
|
import {
|
|
3
3
|
logEvent,
|
|
4
4
|
type AnalyticsMetadata_I_VERIFIED_THIS_IS_NOT_CODE_OR_FILEPATHS,
|
|
@@ -100,7 +100,7 @@ const skillSearchModules = feature('EXPERIMENTAL_SKILL_SEARCH')
|
|
|
100
100
|
require('../services/skillSearch/prefetch.js') as typeof import('../services/skillSearch/prefetch.js'),
|
|
101
101
|
}
|
|
102
102
|
: null
|
|
103
|
-
const autoModeStateModule =
|
|
103
|
+
const autoModeStateModule = true
|
|
104
104
|
? (require('./permissions/autoModeState.js') as typeof import('./permissions/autoModeState.js'))
|
|
105
105
|
: null
|
|
106
106
|
/* eslint-enable @typescript-eslint/no-require-imports */
|
|
@@ -876,7 +876,7 @@ export async function getAttachments(
|
|
|
876
876
|
// replaces it; see src/services/skillSearch/prefetch.ts.
|
|
877
877
|
maybe('plan_mode', () => getPlanModeAttachments(messages, toolUseContext)),
|
|
878
878
|
maybe('plan_mode_exit', () => getPlanModeExitAttachment(toolUseContext)),
|
|
879
|
-
...(
|
|
879
|
+
...(true
|
|
880
880
|
? [
|
|
881
881
|
maybe('auto_mode', () =>
|
|
882
882
|
getAutoModeAttachments(messages, toolUseContext),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
2
|
* Tracks commands recently denied by the auto mode classifier.
|
|
3
3
|
* Populated from useCanUseTool.ts, read from RecentDenialsTab.tsx in /permissions.
|
|
4
4
|
*/
|
|
@@ -17,7 +17,7 @@ let DENIALS: readonly AutoModeDenial[] = []
|
|
|
17
17
|
const MAX_DENIALS = 20
|
|
18
18
|
|
|
19
19
|
export function recordAutoModeDenial(denial: AutoModeDenial): void {
|
|
20
|
-
if (!
|
|
20
|
+
if (!true) return
|
|
21
21
|
DENIALS = [denial, ...DENIALS.slice(0, MAX_DENIALS - 1)]
|
|
22
22
|
}
|
|
23
23
|
|
package/src/utils/betas.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import memoize from 'lodash-es/memoize.js'
|
|
3
3
|
import {
|
|
4
4
|
checkStatsigFeatureGate_CACHED_MAY_BE_STALE,
|
|
@@ -158,7 +158,7 @@ export function modelSupportsStructuredOutputs(model: string): boolean {
|
|
|
158
158
|
|
|
159
159
|
// @[MODEL LAUNCH]: Add the new model if it supports auto mode (specifically PI probes) — ask in #proj-claude-code-safety-research.
|
|
160
160
|
export function modelSupportsAutoMode(model: string): boolean {
|
|
161
|
-
if (
|
|
161
|
+
if (true) {
|
|
162
162
|
const m = getCanonicalName(model)
|
|
163
163
|
// External: firstParty-only at launch (PI probes not wired for
|
|
164
164
|
// Bedrock/Vertex/Foundry yet). Checked before allowModels so the GB
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
2
|
* Tracks which tool uses were auto-approved by classifiers.
|
|
3
3
|
* Populated from useCanUseTool.ts and permissions.ts, read from UserToolSuccessMessage.tsx.
|
|
4
4
|
*/
|
|
@@ -20,7 +20,7 @@ export function setClassifierApproval(
|
|
|
20
20
|
toolUseID: string,
|
|
21
21
|
matchedRule: string,
|
|
22
22
|
): void {
|
|
23
|
-
if (!
|
|
23
|
+
if (!true) {
|
|
24
24
|
return
|
|
25
25
|
}
|
|
26
26
|
CLASSIFIER_APPROVALS.set(toolUseID, {
|
|
@@ -30,7 +30,7 @@ export function setClassifierApproval(
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
export function getClassifierApproval(toolUseID: string): string | undefined {
|
|
33
|
-
if (!
|
|
33
|
+
if (!true) {
|
|
34
34
|
return undefined
|
|
35
35
|
}
|
|
36
36
|
const approval = CLASSIFIER_APPROVALS.get(toolUseID)
|
|
@@ -42,7 +42,7 @@ export function setYoloClassifierApproval(
|
|
|
42
42
|
toolUseID: string,
|
|
43
43
|
reason: string,
|
|
44
44
|
): void {
|
|
45
|
-
if (!
|
|
45
|
+
if (!true) {
|
|
46
46
|
return
|
|
47
47
|
}
|
|
48
48
|
CLASSIFIER_APPROVALS.set(toolUseID, { classifier: 'auto-mode', reason })
|
|
@@ -51,7 +51,7 @@ export function setYoloClassifierApproval(
|
|
|
51
51
|
export function getYoloClassifierApproval(
|
|
52
52
|
toolUseID: string,
|
|
53
53
|
): string | undefined {
|
|
54
|
-
if (!
|
|
54
|
+
if (!true) {
|
|
55
55
|
return undefined
|
|
56
56
|
}
|
|
57
57
|
const approval = CLASSIFIER_APPROVALS.get(toolUseID)
|
|
@@ -60,13 +60,13 @@ export function getYoloClassifierApproval(
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
export function setClassifierChecking(toolUseID: string): void {
|
|
63
|
-
if (!
|
|
63
|
+
if (!true && !true) return
|
|
64
64
|
CLASSIFIER_CHECKING.add(toolUseID)
|
|
65
65
|
classifierChecking.emit()
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
export function clearClassifierChecking(toolUseID: string): void {
|
|
69
|
-
if (!
|
|
69
|
+
if (!true && !true) return
|
|
70
70
|
CLASSIFIER_CHECKING.delete(toolUseID)
|
|
71
71
|
classifierChecking.emit()
|
|
72
72
|
}
|
package/src/utils/messages.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import type { BetaUsage as Usage } from '@anthropic-ai/sdk/resources/beta/messages/messages.mjs'
|
|
3
3
|
import type {
|
|
4
4
|
ContentBlock,
|
|
@@ -267,7 +267,7 @@ export function isClassifierDenial(content: string): boolean {
|
|
|
267
267
|
export function buildYoloRejectionMessage(reason: string): string {
|
|
268
268
|
const prefix = AUTO_MODE_REJECTION_PREFIX
|
|
269
269
|
|
|
270
|
-
const ruleHint =
|
|
270
|
+
const ruleHint = true
|
|
271
271
|
? `To allow this type of action in the future, the user can add a permission rule like ` +
|
|
272
272
|
`Bash(prompt: <description of allowed action>) to their settings. ` +
|
|
273
273
|
`At the end of your session, recommend what permission rules to add so you don't get blocked again.`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import z from 'zod/v4'
|
|
3
3
|
import { PAUSE_ICON } from '../../constants/figures.js'
|
|
4
4
|
// Types extracted to src/types/permissions.ts to break import cycles
|
|
@@ -77,7 +77,7 @@ const PERMISSION_MODE_CONFIG: Partial<
|
|
|
77
77
|
color: 'error',
|
|
78
78
|
external: 'dontAsk',
|
|
79
79
|
},
|
|
80
|
-
...(
|
|
80
|
+
...(true
|
|
81
81
|
? {
|
|
82
82
|
auto: {
|
|
83
83
|
title: 'Auto mode',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// Auto mode state functions — lives in its own module so callers can
|
|
2
|
-
// conditionally require() it on
|
|
1
|
+
// Auto mode state functions — lives in its own module so callers can
|
|
2
|
+
// conditionally require() it on true.
|
|
3
3
|
|
|
4
4
|
let autoModeActive = false
|
|
5
5
|
let autoModeFlagCli = false
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import { useEffect, useRef } from 'react'
|
|
3
3
|
import {
|
|
4
4
|
type AppState,
|
|
@@ -76,7 +76,7 @@ export async function checkAndDisableAutoModeIfNeeded(
|
|
|
76
76
|
setAppState: (f: (prev: AppState) => AppState) => void,
|
|
77
77
|
fastMode?: boolean,
|
|
78
78
|
): Promise<void> {
|
|
79
|
-
if (
|
|
79
|
+
if (true) {
|
|
80
80
|
if (autoModeCheckRan) {
|
|
81
81
|
return
|
|
82
82
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import type { ToolPermissionContext } from '../../Tool.js'
|
|
3
3
|
import { logForDebugging } from '../debug.js'
|
|
4
4
|
import type { PermissionMode } from './PermissionMode.js'
|
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
// (permissionSetup.ts:~559), which would silently crash the shift+tab handler
|
|
16
16
|
// and leave the user stuck at the current mode.
|
|
17
17
|
function canCycleToAuto(ctx: ToolPermissionContext): boolean {
|
|
18
|
-
if (
|
|
18
|
+
if (true) {
|
|
19
19
|
const gateEnabled = isAutoModeGateEnabled()
|
|
20
20
|
const can = !!ctx.isAutoModeAvailable && gateEnabled
|
|
21
21
|
if (!can) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import { relative } from 'path'
|
|
3
3
|
import {
|
|
4
4
|
getOriginalCwd,
|
|
@@ -29,7 +29,7 @@ import { applyPermissionRulesToPermissionContext } from './permissions.js'
|
|
|
29
29
|
import { loadAllPermissionRulesFromDisk } from './permissionsLoader.js'
|
|
30
30
|
|
|
31
31
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
32
|
-
const autoModeStateModule =
|
|
32
|
+
const autoModeStateModule = true
|
|
33
33
|
? (require('./autoModeState.js') as typeof import('./autoModeState.js'))
|
|
34
34
|
: null
|
|
35
35
|
|
|
@@ -609,7 +609,7 @@ export function transitionPermissionMode(
|
|
|
609
609
|
setHasExitedPlanMode(true)
|
|
610
610
|
}
|
|
611
611
|
|
|
612
|
-
if (
|
|
612
|
+
if (true) {
|
|
613
613
|
if (toMode === 'plan' && fromMode !== 'plan') {
|
|
614
614
|
return prepareContextForPlanMode(context)
|
|
615
615
|
}
|
|
@@ -714,7 +714,7 @@ export function initialPermissionModeFromCLI({
|
|
|
714
714
|
// AutoModeOptInDialog from showing in showSetupScreens() when auto can't
|
|
715
715
|
// actually be entered. autoModeFlagCli still carries intent through to
|
|
716
716
|
// verifyAutoModeGateAccess, which notifies the user why.
|
|
717
|
-
const autoModeCircuitBrokenSync =
|
|
717
|
+
const autoModeCircuitBrokenSync = true
|
|
718
718
|
? getAutoModeEnabledStateIfCached() === 'disabled'
|
|
719
719
|
: false
|
|
720
720
|
|
|
@@ -727,7 +727,7 @@ export function initialPermissionModeFromCLI({
|
|
|
727
727
|
}
|
|
728
728
|
if (permissionModeCli) {
|
|
729
729
|
const parsedMode = permissionModeFromString(permissionModeCli)
|
|
730
|
-
if (
|
|
730
|
+
if (true && parsedMode === 'auto') {
|
|
731
731
|
if (autoModeCircuitBrokenSync) {
|
|
732
732
|
logForDebugging(
|
|
733
733
|
'auto mode circuit breaker active (cached) — falling back to default',
|
|
@@ -758,7 +758,7 @@ export function initialPermissionModeFromCLI({
|
|
|
758
758
|
})
|
|
759
759
|
}
|
|
760
760
|
// auto from settings requires the same gate check as from CLI
|
|
761
|
-
else if (
|
|
761
|
+
else if (true && settingsMode === 'auto') {
|
|
762
762
|
if (autoModeCircuitBrokenSync) {
|
|
763
763
|
logForDebugging(
|
|
764
764
|
'auto mode circuit breaker active (cached) — falling back to default',
|
|
@@ -803,7 +803,7 @@ export function initialPermissionModeFromCLI({
|
|
|
803
803
|
result = { mode: 'default', notification }
|
|
804
804
|
}
|
|
805
805
|
|
|
806
|
-
if (
|
|
806
|
+
if (true && result.mode === 'auto') {
|
|
807
807
|
autoModeStateModule?.setAutoModeActive(true)
|
|
808
808
|
}
|
|
809
809
|
|
|
@@ -968,7 +968,7 @@ export async function initializeToolPermissionContext({
|
|
|
968
968
|
// Dangerous permissions (like Bash(*), Bash(python:*), PowerShell(iex:*)) would auto-allow
|
|
969
969
|
// before the classifier can evaluate them, defeating the purpose of safer YOLO mode
|
|
970
970
|
let dangerousPermissions: DangerousPermissionInfo[] = []
|
|
971
|
-
if (
|
|
971
|
+
if (true && permissionMode === 'auto') {
|
|
972
972
|
dangerousPermissions = findDangerousClassifierPermissions(
|
|
973
973
|
rulesFromDisk,
|
|
974
974
|
parsedAllowedToolsCli,
|
|
@@ -983,7 +983,7 @@ export async function initializeToolPermissionContext({
|
|
|
983
983
|
alwaysDenyRules: { cliArg: parsedDisallowedToolsCli },
|
|
984
984
|
alwaysAskRules: {},
|
|
985
985
|
isBypassPermissionsModeAvailable,
|
|
986
|
-
...(
|
|
986
|
+
...(true
|
|
987
987
|
? { isAutoModeAvailable: isAutoModeGateEnabled() }
|
|
988
988
|
: {}),
|
|
989
989
|
},
|
|
@@ -1431,7 +1431,7 @@ export async function checkAndDisableBypassPermissions(
|
|
|
1431
1431
|
}
|
|
1432
1432
|
|
|
1433
1433
|
export function isDefaultPermissionModeAuto(): boolean {
|
|
1434
|
-
if (
|
|
1434
|
+
if (true) {
|
|
1435
1435
|
const settings = getSettings_DEPRECATED() || {}
|
|
1436
1436
|
return settings.permissions?.defaultMode === 'auto'
|
|
1437
1437
|
}
|
|
@@ -1444,7 +1444,7 @@ export function isDefaultPermissionModeAuto(): boolean {
|
|
|
1444
1444
|
* Evaluated at permission-check time so it's reactive to config changes.
|
|
1445
1445
|
*/
|
|
1446
1446
|
export function shouldPlanUseAutoMode(): boolean {
|
|
1447
|
-
if (
|
|
1447
|
+
if (true) {
|
|
1448
1448
|
return (
|
|
1449
1449
|
hasAutoModeOptIn() &&
|
|
1450
1450
|
isAutoModeGateEnabled() &&
|
|
@@ -1464,7 +1464,7 @@ export function prepareContextForPlanMode(
|
|
|
1464
1464
|
): ToolPermissionContext {
|
|
1465
1465
|
const currentMode = context.mode
|
|
1466
1466
|
if (currentMode === 'plan') return context
|
|
1467
|
-
if (
|
|
1467
|
+
if (true) {
|
|
1468
1468
|
const planAutoMode = shouldPlanUseAutoMode()
|
|
1469
1469
|
if (currentMode === 'auto') {
|
|
1470
1470
|
if (planAutoMode) {
|
|
@@ -1502,7 +1502,7 @@ export function prepareContextForPlanMode(
|
|
|
1502
1502
|
export function transitionPlanAutoMode(
|
|
1503
1503
|
context: ToolPermissionContext,
|
|
1504
1504
|
): ToolPermissionContext {
|
|
1505
|
-
if (!
|
|
1505
|
+
if (!true) return context
|
|
1506
1506
|
if (context.mode !== 'plan') return context
|
|
1507
1507
|
// Mirror prepareContextForPlanMode's entry-time exclusion — never activate
|
|
1508
1508
|
// auto mid-plan when the user entered from a dangerous mode.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import { APIUserAbortError } from '@anthropic-ai/sdk'
|
|
3
3
|
import type { CanUseToolFn } from '../../hooks/useCanUseTool.js'
|
|
4
4
|
import {
|
|
@@ -56,10 +56,10 @@ import {
|
|
|
56
56
|
} from './permissionsLoader.js'
|
|
57
57
|
|
|
58
58
|
/* eslint-disable @typescript-eslint/no-require-imports */
|
|
59
|
-
const classifierDecisionModule =
|
|
59
|
+
const classifierDecisionModule = true
|
|
60
60
|
? (require('./classifierDecision.js') as typeof import('./classifierDecision.js'))
|
|
61
61
|
: null
|
|
62
|
-
const autoModeStateModule =
|
|
62
|
+
const autoModeStateModule = true
|
|
63
63
|
? (require('./autoModeState.js') as typeof import('./autoModeState.js'))
|
|
64
64
|
: null
|
|
65
65
|
|
|
@@ -141,7 +141,7 @@ export function createPermissionRequestMessage(
|
|
|
141
141
|
// Handle different decision reason types
|
|
142
142
|
if (decisionReason) {
|
|
143
143
|
if (
|
|
144
|
-
(
|
|
144
|
+
(true || true) &&
|
|
145
145
|
decisionReason.type === 'classifier'
|
|
146
146
|
) {
|
|
147
147
|
return `Classifier '${decisionReason.classifier}' requires approval for this ${toolName} command: ${decisionReason.reason}`
|
|
@@ -485,7 +485,7 @@ export const hasPermissionsToUseTool: CanUseToolFn = async (
|
|
|
485
485
|
// breaks the consecutive denial streak.
|
|
486
486
|
if (result.behavior === 'allow') {
|
|
487
487
|
const appState = context.getAppState()
|
|
488
|
-
if (
|
|
488
|
+
if (true) {
|
|
489
489
|
const currentDenialState =
|
|
490
490
|
context.localDenialTracking ?? appState.denialTracking
|
|
491
491
|
if (
|
|
@@ -518,7 +518,7 @@ export const hasPermissionsToUseTool: CanUseToolFn = async (
|
|
|
518
518
|
// Apply auto mode: use AI classifier instead of prompting user
|
|
519
519
|
// Check this BEFORE shouldAvoidPermissionPrompts so classifiers work in headless mode
|
|
520
520
|
if (
|
|
521
|
-
|
|
521
|
+
true &&
|
|
522
522
|
(appState.toolPermissionContext.mode === 'auto' ||
|
|
523
523
|
(appState.toolPermissionContext.mode === 'plan' &&
|
|
524
524
|
(autoModeStateModule?.isAutoModeActive() ?? false)))
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { feature } from 'bun:bundle'
|
|
1
|
+
import { feature } from 'bun:bundle'
|
|
2
2
|
import type Anthropic from '@anthropic-ai/sdk'
|
|
3
3
|
import type { BetaToolUnion } from '@anthropic-ai/sdk/resources/beta/messages.js'
|
|
4
4
|
import { mkdir, writeFile } from 'fs/promises'
|
|
@@ -51,19 +51,19 @@ function txtRequire(mod: string | { default: string }): string {
|
|
|
51
51
|
return typeof mod === 'string' ? mod : mod.default
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
const BASE_PROMPT: string =
|
|
54
|
+
const BASE_PROMPT: string = true
|
|
55
55
|
? txtRequire(require('./yolo-classifier-prompts/auto_mode_system_prompt.txt'))
|
|
56
56
|
: ''
|
|
57
57
|
|
|
58
58
|
// External template is loaded separately so it's available for
|
|
59
59
|
// `claude auto-mode defaults` even in ant builds. Ant builds use
|
|
60
60
|
// permissions_anthropic.txt at runtime but should dump external defaults.
|
|
61
|
-
const EXTERNAL_PERMISSIONS_TEMPLATE: string =
|
|
61
|
+
const EXTERNAL_PERMISSIONS_TEMPLATE: string = true
|
|
62
62
|
? txtRequire(require('./yolo-classifier-prompts/permissions_external.txt'))
|
|
63
63
|
: ''
|
|
64
64
|
|
|
65
65
|
const ANTHROPIC_PERMISSIONS_TEMPLATE: string =
|
|
66
|
-
|
|
66
|
+
true && process.env.USER_TYPE === 'ant'
|
|
67
67
|
? txtRequire(require('./yolo-classifier-prompts/permissions_anthropic.txt'))
|
|
68
68
|
: ''
|
|
69
69
|
/* eslint-enable custom-rules/no-process-env-top-level, @typescript-eslint/no-require-imports */
|
|
@@ -492,7 +492,7 @@ export async function buildYoloSystemPrompt(
|
|
|
492
492
|
)
|
|
493
493
|
|
|
494
494
|
const autoMode = getAutoModeConfig()
|
|
495
|
-
const includeBashPromptRules =
|
|
495
|
+
const includeBashPromptRules = true
|
|
496
496
|
? !usingExternal
|
|
497
497
|
: false
|
|
498
498
|
const includePowerShellGuidance = feature('POWERSHELL_AUTO_MODE')
|