mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-08 13:12:08 +00:00
Bring apps/desktop and ui-tui to a clean state for typecheck, eslint,
and prettier:
- Run prettier across both trees (printWidth/wrap drift; prettier is not
CI-enforced for these JS projects, so main had accumulated drift).
- Apply eslint --fix for padding-line-between-statements and perfectionist
import/export sorting.
- Manual fixes for non-auto-fixable rules:
- remove unused node:net import in electron/main.cjs (uses Electron net)
- replace inline `typeof import(...)` annotations with top-level
`import type * as EnvModule` in two ui-tui test files
- scoped eslint-disable no-control-regex on intentional sentinel/ANSI
regexes (mathUnicode.ts, text.ts)
- resolve react-hooks/exhaustive-deps per-case: correct swapped/missing
deps, collapse redundant session.* members, and justified disables on
settings mount-only data-load effects to preserve run-once behavior
No behavior changes; test pass/fail counts are unchanged from the main
baseline.
47 lines
1.4 KiB
TypeScript
47 lines
1.4 KiB
TypeScript
import { setYoloActive } from '@/store/session'
|
|
|
|
export type GatewayRequester = <T = unknown>(method: string, params?: Record<string, unknown>) => Promise<T>
|
|
|
|
/**
|
|
* Toggle per-session YOLO (approval bypass) via gateway `config.set` — the same
|
|
* session-scoped flag as the TUI's Shift+Tab. It does NOT touch the global
|
|
* `approvals.mode` config, so CLI / TUI / cron behavior is unaffected.
|
|
*/
|
|
export async function setSessionYolo(
|
|
requestGateway: GatewayRequester,
|
|
sessionId: string,
|
|
enabled: boolean
|
|
): Promise<boolean> {
|
|
const result = await requestGateway<{ value?: string }>('config.set', {
|
|
key: 'yolo',
|
|
session_id: sessionId,
|
|
value: enabled ? '1' : '0'
|
|
})
|
|
|
|
const active = result?.value === '1'
|
|
|
|
setYoloActive(active)
|
|
|
|
return active
|
|
}
|
|
|
|
/**
|
|
* Toggle GLOBAL YOLO (approval bypass) via gateway `config.set` with
|
|
* `scope: 'global'`. This flips the persistent `approvals.mode` in config.yaml
|
|
* between `off` (bypass on) and `manual` (bypass off), affecting every session,
|
|
* the CLI, the TUI, and cron — and it survives restarts. Triggered by
|
|
* Shift+clicking the status-bar zap.
|
|
*/
|
|
export async function setGlobalYolo(requestGateway: GatewayRequester, enabled: boolean): Promise<boolean> {
|
|
const result = await requestGateway<{ value?: string }>('config.set', {
|
|
key: 'yolo',
|
|
scope: 'global',
|
|
value: enabled ? '1' : '0'
|
|
})
|
|
|
|
const active = result?.value === '1'
|
|
|
|
setYoloActive(active)
|
|
|
|
return active
|
|
}
|