Review finding on this PR: the tool layer ran every video backend's sources
through the FAL helper, which also downscales to the managed FAL gateway's
3.5 MB budget. xAI, OpenRouter and DeepInfra have no such cap, so a large
data: URL the caller already supplied (or a big local file) was silently
re-encoded smaller (2048x2048 PNG -> 1536x1536 JPEG) for them.
Split the guarded path-to-data: conversion from the budget fit. The tool
layer always does the former; it applies the latter only when the active
provider declares `max_inline_image_chars` in capabilities(). FAL declares
the managed gateway's budget; the others send images at full size.
Eight bundled plugins already build their User-Agent header with
hermes_user_agent: six model providers, the Slack adapter and the
Perplexity web provider. Each was a baselined private import. The name is
now on the published plugin list, with a section in the plugin guide, and
those eight baseline rows go.
The xAI plugins need the same name before tools/xai_http.py can be split:
its hermes_xai_user_agent returns the string
hermes_user_agent("Hermes-Agent") returns.
Review findings on the wake-turn notice skip.
A quota or billing failure keeps the fallback serving for a cooldown, so the
next turn the user sends makes no new switch: after a switch hidden on a wake
turn, the user's turn ran on the backup with no notice at all. The hidden notice
is now held; the next non-wake turn announces it before it runs if the fallback
is still serving, and drops it if the primary came back (the user never saw it
leave).
The turn-start "Primary model restored" line also fired on wake turns, so each
wake during an outage restored, re-failed and posted it again. It is now skipped
on wake turns and for a switch the user never saw. The restore line moves into
agent/fallback_notice.py beside the switch notice.
The test now drives real run_conversation turns against a loopback provider
(primary 402, backup streaming): two wakes, then a user turn, and a wake after
the cooldown. Both cases fail on main and on the previous head.
Since the fallback notice moved to the moment of the switch, every background
wake turn (a finished background process, a plugin's scheduled check) that
falls back posts it into the chat, and most of those turns then end silent.
One plugin posted it on 27 of 27 wakes during a primary outage (#137738).
Whether a turn is a wake is known when it starts (its persisted display kind),
so the notice is skipped there and logged instead. A turn the user sent still
gets it at the switch. A switch decided before a wake turn stays pending for
the next turn the user sees.
Holding the notice until the final reply is known (#137749's shape) would bring
back the at-the-end timing on every turn, which Teknium ruled against.
Refs #137738; supersedes #137749 by @KoNit-K.
A fallback switch was announced only after the fallback finished answering, so a
long turn ran on the backup model while every surface still showed the pick (a
two-hour task looked like it ran on Qwen and had run on Grok). The notice also
named only a category ("provider failure"), never the provider's error.
The switch now posts its notice at the switch, before the fallback model is
called, and quotes the provider's own error (the summary the error handler
already computes, redacted and capped at 200 chars). A switch decided before the
turn (primary credentials failed at build) is announced at turn start. The notice
stays display-only and still obeys display.suppress_warning_notifications.
The notice wording moves to agent/fallback_notice.py, which also takes
chat_completion_helpers.py back under its line cap.
tools/microsoft_graph_auth.py and tools/microsoft_graph_client.py register
no tool and only Teams code imports them, four of six imports from
plugins/teams_pipeline/. They move there as graph_auth.py and
graph_client.py, with their two tests under tests/plugins/teams_pipeline/.
- Importers change one import line where it stands; summary_writer.py
keeps its imports inside _build_graph_client.
- The Graph client's only core import, parse_retry_after_seconds, is on
the published plugin API.
- boundary_lint baseline drops the 8 rows for these imports; an import of
another in-tree plugin is not a crossing (module_to_core 833 -> 825).
- The Graph app registration guide and its zh-Hans copy name the new path.
- Nothing stays at the old paths; neither module is on a frozen list.
Measured: with teams_pipeline disabled, Graph delivery from the Teams
summary writer still works, but its first call now imports the
teams_pipeline package (17 Hermes modules instead of 2), because
plugins/teams_pipeline/__init__.py imports its CLI.
Plugins that call a rate-limited HTTP API need to read the Retry-After
header. Discord, Signal and Slack already import Hermes's parser as
baselined private crossings, and the Microsoft Graph client needs it to
move into the teams_pipeline plugin.
- plugin_api.json lists the one name; public-api.md is regenerated.
- plugins/index.md gains a short section with the contract and an example.
- boundary_lint baseline drops the three crossings that are now public
(Discord, Signal, Slack). No other line changes; a full --update would
also drop two unrelated stale rows, so it was not used.
- Test: a plugin importing the parser validates with no private-import
warning, while another name from agent.retry_utils still warns. Red on
main.
Messaging is its own page (sidebar, command palette), not a Settings tab, so a user who opened
Settings looking for it would not find it. Every line this PR adds now names the Messaging page:
the confirm and done screens, the user guide, the CLI reference, the import's printed hint.
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
Hermes Cloud runs with HOME set to the Hermes home, so the agent's workspace/, home/ and the
container's dotfiles (.ssh, .gitconfig, .config, ...) sit in the root home, and no backup from
another machine carries them. The replace pruned them all. The root's workspace/, home/ and
non-Hermes dot-entries are now never pruned (transfer and undo alike); Hermes' own root
dot-files (.env, .op.env, .anthropic_oauth.json, .hermes_history) are still replaced.
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
A bot token answers to one running Hermes at a time. The transfer now
brings Telegram, Discord, Slack and every other messaging bot over with
its token and settings but switched off, so the computer it came from
keeps answering until the user switches each bot over by hand.
`hermes import --keep-host --messaging-off` (the Desktop transfer route
always passes it; the undo never does): in the root home and in each
profile the archive carries, every bot the archive would run (an
`enabled: true` block, or a token in that home's .env with no `enabled`
set) gets `platforms.<id>.enabled: false`, the switch Settings >
Messaging writes, inside the same merged config.yaml the keep-host
restore publishes. The explicit false sets the gateway's
_enabled_explicit marker, so the env token cannot re-enable it, and
turning the switch on in Settings > Messaging is the only step needed.
The import prints `Messaging switched off: <names>`, the action status
returns them as `messaging_off`, and the Desktop done screen names them.
The confirm note says the bots come over switched off.
The confirm screen said to stop the local bots, which reads as "before".
Someone talking to Hermes through Telegram would then cut themselves off
before the cloud agent is ready. The confirm note, the done screen and
the docs now say: keep using them here until the transfer is done, then
turn them off in Settings → Messaging.
- Transfer streams: each 8 MiB base64 chunk read off the source is posted to
the cloud agent's /api/ops/transfer/chunk as it is (retry with backoff,
offset_gap re-sync), then /transfer/restore. Peak memory is one chunk; no
multipart, so a first native Cloud sign-in (cookie session only) uploads
over the same JSON path every other call uses.
- A cloud agent without `import_keep_host` in /api/status gets "This cloud
agent needs a Hermes update before it can receive a transfer." before
anything is read or uploaded (BearHuddleston's finding and test idea).
- The undo point reaches the UI from the import's status as soon as it
exists, also on failure; the error screen offers Undo next to Retry, and
Undo always restores the FIRST undo point of that agent (a retry never
replaces it). An import that finished without one is an error.
- Cancel is offered while backing up and copying only; once the restore is
requested it is gone (it cannot be stopped).
- One backup implementation: hermes-cloud-agents `backup()` reuses runBackup;
the save downloads /api/ops/backup/download from the backend that wrote the
archive (never /api/fs/download, which an SSH backend serves remotely).
- Webapp: sign-in reuses the connection the saved-connection OAuth created
(no duplicate save); "Sign in" sends a signed-out Webapp to Settings >
Providers; the remote-browser paste field is mounted in the transfer card.
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
`--keep-host` was a second restore wrapped around `hermes import`: a
`_KeepHostZip` proxy merged every member named config.yaml/.env, a separate
writer published auth.json members without the import's path checks, and a
prune ran after the maintenance reservation was released. Reviews of #156330
reproduced the results: a `../x/auth.json` member written outside the home, a
symlinked skills/ emptied through the link (and missing from Undo), a skill's
templates/config.yaml stripped, a destination-only profile half-emptied while
its gateway ran, comments lost, and an Undo that left the source's
cron/jobs.json behind.
Now keep-host is a per-member policy (`KeepHostImport`) inside
`_import_members_exclusive`, under the same `exclusive_maintenance`
reservation (which also covers every profile the archive writes into):
- Every member goes through the import's own normalize + resolved-root
checks. Only the root home's config.yaml/.env and the root's and each
profile's auth.json are merged; everything else, including a named
profile's config and a skill's files, is copied unchanged.
- config.yaml is written onto the archive's own document with the
comment-preserving `atomic_config_replace`; auth.json goes through the auth
store's lock and writer (`_auth_restore_target`, `_save_auth_store`);
.env under `_env_write_lock`. When the merge changes nothing (an undo), the
archive's bytes are published as they are.
- Replace: after a restore with no errors, files the archive lacks are
removed in the root home and in every profile the archive carries (the
backup's own walk, so links are never entered), and a missing auth.json/
.env/config.yaml leaves only the host-owned part. A profile only the
destination has is left untouched. Databases, logs, runtime records,
lock files, install_id, webapp/ and shared/nous_auth.json stay.
- A folder the archive writes into that is a symlink refuses the import
before any write.
- The undo point is taken after the gateway drained, under the reservation,
with the `hermes backup` collector (`_external/` memory-provider files
included, plus the external files the archive will overwrite). The import
owns its path and prints `Undo point: <path>`; the last 3 are kept. A
restore that wrote files and failed leaves a marker; the next keep-host
import reuses that first undo point. The hidden `--undo-point` flag is gone.
- "Import refused; no files restored" is printed only for a refusal before
the first write (`KeepHostRefused`, `OwnershipConflict`).
- `s6-svc -O` runs inside the try; an unprobeable s6 slot refuses.
Includes kvnloo's `_external/` undo-point fix (cherry-picked as the previous
commit) and BearHuddleston's root-only merge, both folded into this design.
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
Co-authored-by: kvnloo <7121943+kvnloo@users.noreply.github.com>
The restore half of Settings > Backup & Transfer. `hermes import <zip> --keep-host` restores a
`hermes backup` archive over an agent whose host provisioned part of it (a Hermes Cloud agent):
- auth.json: the destination keeps its Nous Portal sign-in (providers.nous, nous pool rows,
active_provider when nous); every other login comes from the archive. Merged against the live
store under the auth lock; the archive's Nous tokens never land on disk.
- config.yaml: HOST_CONFIG_KEYS (model, providers, fallback*, auxiliary, nous, auth, web, image_gen,
video_gen, tts, stt, dashboard, webapp, cron, session caps) keep the destination's value.
- .env: NOUS_*, HERMES_*, TOOL_GATEWAY_*, API_SERVER_KEY keep the destination's lines, in place.
- skills/ and memories/ become exactly the archive's (replace, not merge).
- A full backup of the destination is written first (backups/pre-transfer-*.zip, the undo point);
`hermes import <it> --force --keep-host` puts the agent back.
- In the s6 container the gateway owns state.db, so a plain import refuses it. --keep-host marks the
gateway's slot run-once, asks it to drain and exit over its control socket (pause-for-update), waits
for the profile lock, restores, and starts the slot again.
REST: POST /api/ops/import-upload and /api/ops/import take keep_host and answer the undo archive;
the upload gets a 32 GiB bound instead of the 100 MB managed-file cap. GET /api/ops/backup/chunk reads
a dashboard-written backup in base64 slices (JSON-only clients such as Desktop OAuth connections).
GET /api/cloud/agents lists the Nous account's Hermes Cloud agents for a Webapp tab.
Co-authored-by: SHL0MS <SHL0MS@users.noreply.github.com>
ToolRegistry._toolset_checks, its four upkeep sites and _snapshot_state are
gone. The snapshot already overlaid every live entry's check_fn on that map, so
the map could only contribute an entry for a toolset that no longer has a
check_fn member. Such a toolset holds a tool without check_fn and is therefore
always available, and its only reader (banner.py, presence of check_fn on an
unavailable toolset) never sees it. get_toolset_requirements now derives
check_fn from the live entries (last one wins, as before); the
model_tools.TOOLSET_REQUIREMENTS dict at import is byte-identical before and
after (probe).
model_tools.TOOL_TO_TOOLSET_MAP had one reader, batch_runner, which used only
its keys; it now uses get_all_tool_names() and gets the same 73-name set. The
doctor printed TOOLSET_REQUIREMENTS[tid]["name"], which is always tid; it
prints tid. Doc references and the doctor's model_tools stubs follow.
tools/ holds model tools. These three files register none: they send a
message to a platform for `hermes send` and for cron delivery, through
gateway adapters and gateway config. They move to the gateway package:
tools/send_message_tool.py -> gateway/outbound/send.py
tools/send_message_senders.py -> gateway/outbound/senders.py
tools/send_message_targets.py -> gateway/outbound/targets.py
Twelve test files move with them to tests/gateway/outbound/. Every importer
changes its import line in place. Nothing stays at the old paths: none of
the three names is on the plugin API list, the shipped-release list or the
old-updater list.
Behaviour is unchanged. The logger name stays tools.send_message_tool in
the three files and in the QQ Bot sender that shares it, so the lines stay
under `hermes logs --component tools`. The boundary-lint baseline changes
12 keys and no count, because its keys carry the module path of the
underscore names five bundled plugins import.
The import and docs rewrites were made by scripts/move/rewrite_imports.py
and rewrite_docs.py.
Projects that embed AIAgent and import toolsets.create_custom_toolset to give it an exact tool list import and run again instead of failing with ImportError.
The shared-bot route-gate tests reach the gate through _live_adapter again, so a change that stops forwarding the target thread now fails them.
The zh-Hans tools reference no longer shows an empty messaging toolset section.
Removed. A search for callers by name, attribute and string (Python, TypeScript,
docs, the plugin API list and the frozen old-updater list) finds no supported
path that reaches any of them:
- tools/send_message_tool.py: _handle_list, _handle_react and the action
dispatch in send_message_tool (every caller, including the external
hermes-snooze plugin, passes action="send")
- tools/bot_failure_reasons.py: is_auto_retryable
- tools/clarify_gateway.py: _notify_cbs, _coerce_text_response,
attempt_text_response_for_session, resolve_text_response_for_session
- tools/cronjob_tools.py: the unused task_id parameter of cronjob()
- tools/interrupt.py: is_thread_yield_requested
- toolsets.py: create_custom_toolset
- tools/tool_backend_helpers.py: prefers_gateway, REMOVED_BACKENDS,
removed_backend_note, normalize_modal_mode (callers use coerce_modal_mode)
- hermes_cli/config_value_checks.py: _validate_web_backends (only read the
always-empty REMOVED_BACKENDS map)
Tests that existed only for these symbols are deleted; tests that also
cover live behaviour now call the canonical live names
(attempt_text_response, _coerce_text_response_detailed, consume_yield).
The shared-bot route-gate tests that reached the gate through the deleted
react action now call _shared_bot_target_allowed directly, so the origin
rules (guild-only, thread-under-channel and user_id routes, Telegram topics,
the turn's sender in a shared channel) keep their coverage. The two error
hints and one comment that named send_message(action='list') now name
`hermes send --list`; the stale send_message row in the zh-Hans tools
reference goes.
Also:
- test_messaging_slash_command_fifo spies on clarify_gateway.attempt_text_response,
the name gateway/run_inbound.py calls, so its [clarify] case can fail again
- send_message_tool: an action other than 'send' returns an error that names
`hermes send --list` for listing targets
- multi-profile-gateways.md no longer says send_message sends reactions; the zh-Hans
simplex.md and tools-reference.md match the English pages
Removed. A search for callers by name, attribute and string (Python, TypeScript,
docs, the plugin API list and the frozen old-updater list) finds no supported
path that reaches any of them:
- tools/skills_hub_github.py: unused imports subprocess, windows_hide_flags
- tools/skills_hub_github.py::GitHubSource._parse_frontmatter_quick (tests now call
skills_hub_models._parse_frontmatter directly)
- tools/skills_hub_clawhub.py::ClawHubSource._query_terms/_dedupe_results/_search_score
- tools/skills_hub_skillssh.py::SkillsShSource._strip_html
- tools/skills_hub_official.py::OptionalSkillSource._parse_frontmatter
- tools/skill_lock.py::locked_skill_dirs
- tools/blueprints.py::create_blueprint_job, export_blueprint, _schedule_to_string
(and their tests in tests/tools/test_blueprints.py)
Also:
- creating-skills.md no longer promises exporting a cron job back to a SKILL.md
(no code implements it)
- TestBlueprintBridge in tests/cron/test_suggestions.py asserts the job spec carries
`deliver`, the coverage test_bridges_to_create_job had
- TestParseFrontmatterQuick is renamed TestParseFrontmatter
Removed. A search for callers by name, attribute and string (Python, TypeScript,
docs, the plugin API list and the frozen old-updater list) finds no supported
path that reaches any of them:
- tools/environments/vercel_sandbox.py: _exception_chain, _extract_status_code,
_RETRY_BACKOFF_STEP, _MIN_SANDBOX_TIMEOUT, _MIN_RUNNING_WAIT,
_RUNNING_WAIT_POLL_INTERVAL, _STOP_TIMEOUT, _STOP_POLL_INTERVAL,
_SNAPSHOT_STORE_NAME
- tools/environments/sandbox_scope.py: CredentialRef (docstring in
agent/terminal_env_provider.py and the terminal-environment-plugin guide no
longer name it)
- tools/environments/streams.py: supports_streams() (the provider attribute of
the same name stays)
- completion_reason "failed_start": its producer left in cd818a4d054; drop the
lookups in process_registry_notifications._REASON_STATUS (and its
"Failed to Start" branch), cli_process_dock._STATUS_BY_REASON,
ui-tui processRoster REASON_STATUS, and the field comments
- tools/terminal_hints.py: _EXIT_CODE_HINTS[137] (exit 137 always carries a
SIGKILL exit note, which gates annotate_failure off)
- ProcessRegistry._config_value: unread `fallback` parameter
Removed. A search for callers by name, attribute and string (Python, TypeScript,
docs, the plugin API list and the frozen old-updater list) finds no supported
path that reaches any of them:
- tools/code_execution_tool.py::SANDBOX_AVAILABLE (constant True) and its
two `if not SANDBOX_AVAILABLE` branches; the duplicated gateway-lifecycle
comment in execute_code
- tests: test_windows_returns_error (only flipped the constant) and the
constant's monkeypatch in test_execute_code_lifecycle_guard_deadline
- tools/checkpoint_manager.py: the no-op `store = _store_path(base)` /
`_ = store` pair in _migrate_legacy_store; unused imports
clear_stale_tmp_packs, rmtree_readonly, Dict, List, Set, Tuple;
_list_project_refs (test-only) and its one assertion
- hermes_cli/cli_auto_maintenance.py::_run_checkpoint_auto_maintenance
(imported by cli.py, never called), its cli.py import, its orphaned
`threading` import and its no-op test monkeypatch
- tools/file_operations.py::ShellFileOperations._run_python_snippet
- tools/file_operations_lint.py: the '.py' entry in LINTERS (the in-process
LINTERS_INPROC['.py'] always answers first)
- test_profile_rename_checkpoints: assert the migrate-identity retry deletes the leftover old checkpoint ref (via _ref_tip), replacing the deleted _list_project_refs check.
- docs(checkpoints-and-rollback): auto-prune runs only on the gateway housekeeping tick; the CLI never runs it.
Moves the override from two HERMES_* environment variables to
desktop.ssh_connect_timeout and desktop.ssh_forward_timeout, in whole
seconds up to 120. These are non-secret behavior settings, so they belong
in config.yaml. They are read once before the first window, the same way
desktop.ssh_path is, and passed to every SSH connection the app opens.
The value is validated in full. Only a positive whole number counts.
Values like "45s" or "1.5" are ignored with a startup warning and the
15 second default is kept, instead of being read as a numeric prefix.
Refs #132508
A worker read of prompt_cache_generation went through the required-write
journal: an RPC failure left the journal failed and blocked later writes.
The owner now stamps its durable generation onto the clock inside the
usage.main receipt that already carries it; no extra worker read.
- Every clock storage read (restore, prompt_cache_generation) is best-effort:
sqlite3.Error/OSError/WorkerPersistenceError log at DEBUG and the window
reports unknown (storage_unavailable); a successful reply is never lost.
- RuntimeSessionStore.prompt_cache_generation reads the owner's durable count
(session.cache_generation receipt op), so a managed worker's fresh write is
not reported compacted.
- The agentless /context read compares the saved clock with the row's
persisted model + model_config provider/base_url, and the breakdown cache
key includes them: a session.mutate model switch reports unknown.
The clock modelled every route as "expires = last touch + tier", which is wrong for OpenAI
GPT-5.6+: a read refreshes coverage to at least 30 minutes after it and never restarts a
12h write. It also treated documented minimums as expiries and lost or revived saved state.
- Coverage deadlines per tier with per-route refresh rules: Anthropic family restarts the tier
on read; OpenAI keeps max(existing, read + 30m) and a 12h deadline stays at write + 12h.
- Windows carry guaranteed_until (earliest deadline, so mixed tiers in one response are only as
warm as the shorter) and estimated_until (OpenAI: last touch + 24h retention ceiling; pre-5.6
in_memory 1h). cache_certainly_warm / cache_certainly_cold are the two consumer helpers.
/context: warm until / may still be warm until / expired / unknown.
- Events bind to the session's durable context generation (rows a compaction or prune archived,
SessionDB.prompt_cache_generation), kept as saved on restore; a resumed agent restores and
validates the saved event before folding its first response.
- Route identity is provider + normalize_route_base_url (scheme, host, port, path) + model.
- Agentless session.context_breakdown reads the saved clock (stored_cache_window).
- Codex app-server activity is recorded as an explicit unknown (it sets its own cache options).
- MoA records the resolved aggregator route and the payload the MoA client sent.
- effective_cache_ttl applies the route ceiling on the measured-provider path too.
Every consumer that needs "when does this session's cached prompt expire?" now reads one
answer, agent/prompt_cache_clock.py:cache_window(), instead of re-deriving it from _cache_ttl.
- Per successful attempt the clock records the tier actually on the wire (cache_control ttl,
prompt_cache_options.ttl, prompt_cache_retention, read from the sent payload), the send time,
and the tier the response proved: Anthropic cache_creation.ephemeral_5m/1h_input_tokens,
OpenAI Responses cache_write_tokens_details.ttl_30m/12h_tokens. normalize_usage keeps that
split as CanonicalUsage.cache_write_by_ttl instead of dropping it.
- Per-route rules are a dict of small handlers: native Anthropic proves via the split;
OpenRouter Claude is declared (live-probed to honour 1h); routes with a ceiling are clamped;
other Anthropic-wire gateways assume 5m; OpenAI GPT-5.6+ proves via ttl_30m/12h or declares
the documented 30m minimum; pre-5.6 assumes ~30m (5m on in_memory); implicit caches are
unknown. expires = latest read-or-write send time + the written tier. A route switch,
fallback, session rotation or compaction makes it unknown.
- Route TTL ceiling is data: ProviderProfile.prompt_cache_max_ttl (Nous ships "5m", because
the Portal's upstream drops 1h after ~7 min and bills 5m), overridden per provider by config
prompt_caching.route_ttl_ceilings. effective_cache_ttl uses the same helper, so Hermes stops
asking Nous for 1h. A custom endpoint at the Portal host gets the Nous ceiling.
- Persisted as nullable sessions.prompt_cache_clock (JSON) through the existing token batch;
restored lazily on resume, falling back to the newest assistant row (assumed).
- Codex app-server: read cacheWriteInputTokens instead of hard-coding cache_write_tokens=0.
- /context shows "Prompt cache: warm until HH:MM (…; 1h, proven)", "expired … ago" or
"unknown (…)". The surface is absorbed from #142387 (render/duration helpers, the
SessionContextBreakdownResult.prompt_cache contract and translations), reworked onto the clock.
Co-authored-by: Teknium <127238744+teknium1@users.noreply.github.com>
`do ¬<newline>shell script`, `do (* x *) shell script`, `--`/`#` comments
and a phrase split across two `-e` arguments hid the multi-word risky
phrases from the classifier. The program is now also matched with `¬`
continuations and nested/line comments replaced by spaces (string
literals and |identifiers| skipped, so their `--`/`(*` cannot swallow
code); the raw reading is kept, so this only adds findings.
Also flags Terminal's `do script` (runs a shell command), classifies
osacompile's `-e`/`-l` program like osascript's, and only counts
`osascript` as a whole word when deciding a carrier runs it, so
`python3 -m pytest tests/test_osascript_bridge.py` no longer prompts.
Fixes#141346
The salvaged commits flagged `osascript ... saving no` and kept that key away
from the smart guardian. On current main that still left most of the incident
open. The regex only saw a bare `osascript` with the phrase on one line, so it
missed `quit`, `delete`, keystrokes, `do shell script "rm ..."` (which also
surfaced first as a guardian-reviewable rm rule), heredocs, pipes, carriers
and expansions. A "session" answer also pre-approved every later close.
Replace the regex with a small classifier in tools/approval_applescript.py that
fails closed and does not parse AppleScript:
- it finds each osascript at command position (paths, wrappers, quote and
escape spellings) and reads its program from -e arguments, here-strings
and heredoc bodies;
- a program that uses a verb that can close, quit, save, delete, move, write,
click, send keystrokes or run a shell is flagged, and so is any JXA program;
- a program this command line does not show is flagged: a script file, stdin
from a pipe or redirect, $VAR/$(...)/backtick expansion, an unquoted
heredoc, or osascript run through sh -c, eval, env -S, ssh, xargs,
find -exec or an interpreter.
Detection runs before the flat pattern table, so these manual-only keys come
first in the findings. The gate checks every pending key (not only the
combined description), skips the guardian for them, and offers once/deny
only on every surface: CLI, gateway card, selected transport and pending
record.
Read-only literal scripts are not flagged, as on main. That covers the
frontmost-app query the macOS `open` raise-ladder runs, `activate`,
`display notification` and `get the name of every disk`.
Fixes#141346
`osascript` can drive an application the agent never opened, and the
document it names — `active presentation`, `front document` — belongs to
the operator. `close … saving no` throws that document away and takes the
app's AutoRecovery with it, so the loss has no recovery path; nothing in
the dangerous-pattern table matched an AppleScript payload, so smart
approval had no reason to flag it and auto-approved.
Detect the spellings AppleScript and JXA accept for "close or quit
without saving" (`saving no`, `without saving`, `saving: false`) when
`osascript` sits at command position, so `saving yes`, a plain `save`,
and the phrase quoted as another command's argument stay unflagged.
Detection alone is not enough here: in smart mode the guardian LLM would
still get the last word, and an auxiliary model's APPROVE is not the
consent of the person whose unsaved work it is. Those descriptions now
skip the guardian (`SMART_MANUAL_ONLY_DESCRIPTIONS`) and go straight to
the human prompt — the same shape as the hardline floor, but a prompt
instead of a block.
Follow-up to the salvaged credential-store classification:
- netrc quoted passwords ("a b c") and INI values with internal spaces
(configparser keeps them) were masked only up to the first space, leaving
the rest of the secret visible.
- ~/.aws/config holds aws_secret_access_key / aws_session_token too, and
_netrc is the Windows name curl and git read; both are now secret-bearing
(and _netrc joins the write denylist through the shared basename list).
- Drop the salvaged URL-userinfo pattern: _redact_userinfo_passwords (#125664)
already masks .git-credentials lines on every read, and the extra regex
masked docs placeholders it deliberately keeps.
- Tests move to tests/agent/test_redact_credential_stores.py (size ratchet)
plus a live read_file + terminal cat E2E per store format.
Fixes#124999
read_file and terminal cat only treated .env files, shell rc files and the
Hermes config.yaml as secret-bearing. Reading ~/.aws/credentials, .netrc,
.pgpass, .npmrc, .pypirc or .git-credentials returned the stored secrets
in clear text.
Classify these files as secret-bearing (credentials only under a .aws
parent) using the same list the write denylist already uses. Most of these
files are not KEY=value, so add a secret-file-only pass for their line
formats: netrc password tokens, pgpass fields, URL user:password,
npmrc _authToken and INI "password = x". The terminal path now passes
secret_file too, so both surfaces use the same passes.
`-WhatIf` only reports what the cmdlet would do, but the new PowerShell
power-off floor refused it with no override. Exempt it only when
`-WhatIf` is a bare parameter of the same invocation: a quote, variable,
splat, subexpression, comment or line continuation before it, any
`-WhatIf:<value>`, or a following command keeps the hardline. The
exempted preview is classified as on main (no prompt directly; the
script-execution prompt behind pwsh -c).
Refs #87419
The salvaged Windows hardline rules matched anywhere in the command, so
`git commit -m "never format c:"` hit the floor (the #93392 class). Anchor
them to command position, optionally behind a powershell/pwsh/cmd launcher
(cmdlets are only reachable that way from git-bash), and add the drive-root
analogues of the POSIX root-rm rule: rd/del/Remove-Item recursive deletes
of `C:\`, `C:\*`, `C:\*.*`, plus `rm -rf C:/`. Deeper paths stay in the
approvable tier. The Windows-path detection variant now also gets its
command starts marked so `Get-Date; rd /s /q C:\` is seen. diskpart and
cipher /w stay dangerous-only (interactive / free-space only).
Hardening (SECURITY.md §3.2), not a new boundary.
Fixes#87419
The text_to_speech tool lets the model choose output_path, and the command
provider substituted it into the operator's shell template. Quoting covers
the template's own quote context, but a template that re-parses its
placeholders (sh -c '... {output_path}', or backticks) hands the value to a
second shell parse, where $(...) and backticks in the path ran.
The command now writes a Hermes-named file in its temp directory, which is
moved to the requested path afterwards, so no caller-chosen text reaches the
shell in any template shape.
Reported-by: directorboint-arch
Squashed onto main (#151819). The session.usage conflict with #141859 keeps the
branch side: _usage_nous_fields already reads the Nous fields inside the
session profile scope.
main's #141859 test now stubs both Portal reads: a session off a Nous route reads
with the stored token only (stored_token_account_info).
agent.account_usage keeps the names that moved to agent.account_usage_nous (and
BP_FULL): plugin_api.json publishes the whole module, and catalog plugins import
build_credits_view and build_nous_credits_snapshot from it.
declared_login_command read the login command from the plugin's setup_status(), and for the Claude subscription plugin that runs `claude auth status` (0.4 to 1.8 s, up to its 20 s timeout). The hint is built inline on the gateway's event loop (_hmwa_agent_error_reply), on every resolution while the plugin primary is signed out, and in nonretryable_copy and the cron copy even when their template names no command. On main the hint was the constant `hermes model`.
ProviderProfile gains login_args, the CLI's own sign-in as an argv tail after the resolved binary (`("auth", "login")`). The hint is that binary, found by the same PATH lookup the launch uses, plus login_args; a profile that declares none keeps `hermes model`. The two copy builders only look the hint up when their template uses it.
Reported-by: kshitijk4poor
`--permission-mode bypassPermissions` is the same bypass as
`--dangerously-skip-permissions`; the flags table now says so and points
at the "Opt-in" section. Fold the claude-code contract into the
test_document_obligations table instead of a standalone test, and
require the new clause there. Regenerate the docs page.
Refs #145548
Co-authored-by: BearHuddleston <196404565+BearHuddleston@users.noreply.github.com>
A git worktree only separates where edits land; it adds no filesystem,
network or credential boundary, so the claude-code skill must not offer
it as the place where --dangerously-skip-permissions is acceptable.
Scope bypass to an explicit request with the whole process in a
container, VM or the sandbox runtime as non-root, and regenerate the
docs page.
Fixes#145548
auto_fix_deps.install_model() appended --set-hf-api-token /
--set-civitai-api-token, which comfy-cli persists to config.ini, and
run_cmd() logs the full argv, so a one-off download token was both
written to disk and echoed into agent-visible output. comfy-cli reads
HF_API_TOKEN / CIVITAI_API_TOKEN from its environment without
persisting, so the token now rides in the child env, scoped to the
provider host of the download URL; node installs get no overlay, and
supplied values are redacted from returned child output. Docs examples
switch to the env form; --set-* stays documented as explicit
persistent config.
Fixes#143365