Commit Graph

1947 Commits

Author SHA1 Message Date
Tak Hoffman
6f7ff545dd fix(line): add ACP binding parity (#56700)
* fix(line): support ACP current-conversation binding

* fix(line): add ACP binding routing parity

* docs(changelog): note LINE ACP parity

* fix(line): accept canonical ACP binding targets
2026-03-28 20:52:31 -05:00
AaronLuo00
971ecabe80 fix(memory): account for CJK characters in QMD memory chunking
The QMD memory system uses a fixed 4:1 chars-to-tokens ratio for chunk
sizing, which severely underestimates CJK (Chinese/Japanese/Korean) text
where each character is roughly 1 token. This causes oversized chunks for
CJK users, degrading vector search quality and wasting context window space.

Changes:
- Add shared src/utils/cjk-chars.ts module with CJK-aware character
  counting (estimateStringChars) and token estimation helpers
- Update chunkMarkdown() in src/memory/internal.ts to use weighted
  character lengths for chunk boundary decisions and overlap calculation
- Replace hardcoded estimateTokensFromChars in the context report
  command with the shared utility
- Add 13 unit tests for the CJK estimation module and 5 new tests for
  CJK-aware memory chunking behavior

Backward compatible: pure ASCII/Latin text behavior is unchanged.

Closes #39965
Related: #40216
2026-03-29 10:22:43 +09:00
Gustavo Madeira Santana
2afc655bd5 ACP: document Matrix bind-here support 2026-03-28 21:07:58 -04:00
Robin Waslander
17479ceb43 fix(auto-reply): suppress JSON-wrapped NO_REPLY payloads before channel delivery (#56612)
Add shared isSilentReplyPayloadText() detector that catches both bare
NO_REPLY tokens and JSON {"action":"NO_REPLY"} envelopes. Apply at the
reply directive parser, reply normalizer, and embedded agent payload
builder so the control payload is stripped before any channel sees it.

Preserves media when text is only a silent control envelope.

Fixes #37727
2026-03-28 22:07:24 +01:00
Frank Yang
c14b169a1b fix(acp): repair stale bindings after runtime exits (#56476)
* fix(acp): repair stale bindings after runtime exits

* fix(acp): narrow stale binding recovery

* fix(acp): preserve policy gating for stale sessions

* fix(acp): handle signal exits and canonical unbinds

* fix(acp): harden canonical stale-session recovery
2026-03-29 01:15:16 +08:00
Saurabh Mishra
90e82fabb3 fix: display model name instead of ID in Telegram model selector (#56165) (#56175)
* fix: display model name instead of ID in Telegram model selector (#56165)

* fix(telegram): scope model display names by provider

Signed-off-by: sallyom <somalley@redhat.com>

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: sallyom <somalley@redhat.com>
2026-03-28 09:23:09 -04:00
Peter Steinberger
dec91c400d fix: keep status display on sync model metadata 2026-03-28 11:37:43 +00:00
Peter Steinberger
84d1781a3a fix: avoid status-time provider normalization recursion 2026-03-28 11:35:33 +00:00
Peter Steinberger
0e11072b84 fix: avoid speech runtime import in status output 2026-03-28 11:35:33 +00:00
Peter Steinberger
bd4632b9c1 fix: mark buffered reply typing runs complete 2026-03-28 07:57:28 +00:00
Peter Steinberger
155915e7dc test: dedupe routing and text suites 2026-03-28 07:31:40 +00:00
Peter Steinberger
06fba21a9d test(acp): cover persisted generic conversation binds 2026-03-28 05:53:07 +00:00
Peter Steinberger
83135c31c9 refactor(acp): extract generic current conversation binding store 2026-03-28 05:53:07 +00:00
Gustavo Madeira Santana
b253ca70ef Tests: stabilize Matrix-related shared suites 2026-03-28 01:52:55 -04:00
Peter Steinberger
19e8e7190b fix(acp): avoid no-op gateway self-call after spawn 2026-03-28 05:23:55 +00:00
Peter Steinberger
dee2bde2f5 test(acp): cover generic conversation binds 2026-03-28 03:53:38 +00:00
Peter Steinberger
d0d4b73d25 refactor(acp): centralize conversation binding context 2026-03-28 03:53:38 +00:00
Tak Hoffman
ae2b1aef10 fix(regression): normalize model picker provider endpoint aliases 2026-03-27 22:01:39 -05:00
Peter Steinberger
68416fdf83 refactor(acp): generalize message-channel binds 2026-03-28 02:53:54 +00:00
Peter Steinberger
c42ec81e37 feat(acp): add conversation binds for message channels 2026-03-28 01:54:25 +00:00
Tak Hoffman
d2e25b03fe fix(regression): preserve external command auth context 2026-03-27 20:24:14 -05:00
Tak Hoffman
8a687bdbd7 fix(regression): preserve spawned metadata across auto-reply reset 2026-03-27 20:24:14 -05:00
Tak Hoffman
b598cdf968 fix(regression): preserve discord thread bindings for plugin commands 2026-03-27 20:24:14 -05:00
Peter Steinberger
fef688fb7a test: dedupe utility and config suites 2026-03-28 00:26:55 +00:00
Peter Steinberger
b8069c2bd1 refactor: trim provider model compat seams 2026-03-28 00:17:28 +00:00
Peter Steinberger
13316a9118 refactor: reuse shared model prefix helper in thinking 2026-03-28 00:00:08 +00:00
Peter Steinberger
4ca07559ab refactor: move provider seams behind plugin sdk surfaces 2026-03-27 23:26:26 +00:00
Peter Steinberger
c52f89bd60 test: dedupe helper-heavy test suites 2026-03-27 22:35:27 +00:00
Peter Steinberger
634db43b3f test: debrand fallback and registry pin fixtures 2026-03-27 22:05:34 +00:00
Tak Hoffman
c125c33724 fix(regression): honor internal provider auth for directives 2026-03-27 16:15:09 -05:00
Tak Hoffman
1a9abb13bd fix(regression): preserve CLI continuity across chat reset 2026-03-27 16:01:37 -05:00
Jacob Tomlinson
355abe5eba Discord: enforce approver checks for text approvals (#56015)
* Discord: gate text approvals by approver policy

* Discord: require approvers for plugin text approvals

* Discord: preserve legacy text approval fallback
2026-03-27 20:37:15 +00:00
Jacob Tomlinson
be00fcfccb Gateway: align chat.send reset scope checks (#56009)
* Gateway: align chat.send reset scope checks

* Gateway: tighten chat.send reset regression test

* Gateway: honor internal provider reset scope
2026-03-27 20:36:31 +00:00
Jacob Tomlinson
c603123528 fix(gateway): require admin for persisted verbose defaults (#55916)
* fix(gateway): require admin for verbose persistence

* gateway: tighten verbose persistence follow-ups
2026-03-27 19:04:02 +00:00
Peter Steinberger
ed055f44ae refactor: route plugin runtime through bundled seams 2026-03-27 16:40:27 +00:00
Peter Steinberger
89267f4273 test: finish reply seam cleanup 2026-03-27 16:22:27 +00:00
Peter Steinberger
cd92549119 test: split extension-owned core coverage 2026-03-27 16:08:57 +00:00
Josh Avant
6ade9c474c feat(hooks): add async requireApproval to before_tool_call (#55339)
* Plugins: add native ask dialog for before_tool_call hooks

Extend the before_tool_call plugin hook with a requireApproval return field
that pauses agent execution and waits for real user approval via channels
(Telegram, Discord, /approve command) instead of relying on the agent to
cooperate with a soft block.

- Add requireApproval field to PluginHookBeforeToolCallResult with id, title,
  description, severity, timeout, and timeoutBehavior options
- Extend runModifyingHook merge callback to receive hook registration so
  mergers can stamp pluginId; always invoke merger even for the first result
- Make ExecApprovalManager generic so it can be reused for plugin approvals
- Add plugin.approval.request/waitDecision/resolve gateway methods with
  schemas, scope guards, and broadcast events
- Handle requireApproval in pi-tools via two-phase gateway RPC with fallback
  to soft block when the gateway is unavailable
- Extend the exec approval forwarder with plugin approval message builders
  and forwarding methods
- Update /approve command to fall back to plugin.approval.resolve when exec
  approval lookup fails
- Document before_tool_call requireApproval in hooks docs and unified
  /approve behavior in exec-approvals docs

* Plugins: simplify plugin approval code

- Extract mergeParamsWithApprovalOverrides helper to deduplicate param
  merge logic in before_tool_call hook handling
- Use idiomatic conditional spread syntax in toolContext construction
- Extract callApprovalMethod helper in /approve command to eliminate
  duplicated callGateway calls
- Simplify plugin approval schema by removing unnecessary Type.Union
  with Type.Null on optional fields
- Extract normalizeTrimmedString helper for turn source field trimming

* Tests: add plugin approval wiring and /approve fallback coverage

Fix 3 broken assertions expecting old "Exec approval" message text.
Add tests for the /approve command's exec→plugin fallback path,
plugin approval method registration and scope authorization, and
handler factory key verification.

* UI: wire plugin approval events into the exec approval overlay

Handle plugin.approval.requested and plugin.approval.resolved gateway
events by extending the existing exec approval queue with a kind
discriminator. Plugin approvals reuse the same overlay, queue management,
and expiry timer, with branched rendering for plugin-specific content
(title, description, severity). The decision handler routes resolve calls
to the correct gateway method based on kind.

* fix: read plugin approval fields from nested request payload

The gateway broadcasts plugin approval payloads with title, description,
severity, pluginId, agentId, and sessionKey nested inside the request
object (PluginApprovalRequestPayload), not at the top level. Fix the
parser to read from the correct location so the overlay actually appears.

* feat: invoke plugin onResolution callback after approval decision

Adds onResolution to the requireApproval type and invokes it after
the user resolves the approval dialog, enabling plugins to react to
allow-always vs allow-once decisions.

* docs: add onResolution callback to requireApproval hook documentation

* test: fix /approve assertion for unified approval response text

* docs: regenerate plugin SDK API baseline

* docs: add changelog entry for plugin approval hooks

* fix: harden plugin approval hook reliability

- Add APPROVAL_NOT_FOUND error code so /approve fallback uses structured
  matching instead of fragile string comparison
- Check block before requireApproval so higher-priority plugin blocks
  cannot be overridden by a lower-priority approval
- Race waitDecision against abort signal so users are not stuck waiting
  for the full approval timeout after cancelling a run
- Use null consistently for missing pluginDescription instead of
  converting to undefined
- Add comments explaining the +10s timeout buffer on gateway RPCs

* docs: document block > requireApproval precedence in hooks

* fix: address Phase 1 critical correctness issues for plugin approval hooks

- Fix timeout-allow param bug: return merged hook params instead of
  original params when timeoutBehavior is "allow", preventing security
  plugins from having their parameter rewrites silently discarded.

- Host-generate approval IDs: remove plugin-provided id field from the
  requireApproval type, gateway request, and protocol schema. Server
  always generates IDs via randomUUID() to prevent forged/predictable
  ID attacks.

- Define onResolution semantics: add PluginApprovalResolutions constants
  and PluginApprovalResolution type. onResolution callback now fires on
  every exit path (allow, deny, timeout, abort, gateway error, no-ID).
  Decision branching uses constants instead of hard-coded strings.

- Fix pre-existing test infrastructure issues: bypass CJS mock cache for
  getGlobalHookRunner global singleton, reset gateway mock between tests,
  fix hook merger priority ordering in block+requireApproval test.

* fix: tighten plugin approval schema and add kind-prefixed IDs

Harden the plugin approval request schema: restrict severity to
enum (info|warning|critical), cap timeoutMs at 600s, limit title
to 80 chars and description to 256 chars. Prefix plugin approval
IDs with `plugin:` so /approve routing can distinguish them from
exec approvals deterministically instead of relying on fallback.

* fix: address remaining PR feedback (Phases 1-3 source changes)

* chore: regenerate baselines and protocol artifacts

* fix: exclude requesting connection from approval-client availability check

hasExecApprovalClients() counted the backend connection that issued
the plugin.approval.request RPC as an approval client, preventing
the no-approval-route fast path from firing in headless setups and
causing 120s stalls. Pass the caller's connId so it is skipped.
Applied to both plugin and exec approval handlers.

* Approvals: complete Discord parity and compatibility fallback

* Hooks: make plugin approval onResolution non-blocking

* Hooks: freeze params after approval owner is selected

* Gateway: harden plugin approval request/decision flow

* Discord/Telegram: fix plugin approval delivery parity

* Approvals: fix Telegram plugin approval edge cases

* Auto-reply: enforce Telegram plugin approval approvers

* Approvals: harden Telegram and plugin resolve policies

* Agents: static-import gateway approval call and fix e2e mock loading

* Auto-reply: restore /approve Telegram import boundary

* Approvals: fail closed on no-route and neutralize Discord mentions

* docs: refresh generated config and plugin API baselines

---------

Co-authored-by: Václav Belák <vaclav.belak@gendigital.com>
2026-03-27 09:06:40 -07:00
Peter Steinberger
8ddeada97d test: move extension-owned coverage into plugins 2026-03-27 15:11:33 +00:00
Peter Steinberger
f217a10780 refactor: route more runtime-boundary tests through public seams 2026-03-27 13:46:17 +00:00
Peter Steinberger
e42b4afd39 refactor: route reply plumbing test through slack entry 2026-03-27 13:46:17 +00:00
Peter Steinberger
4019671331 refactor: add runtime-boundary plugin test seams 2026-03-27 13:46:17 +00:00
Peter Steinberger
c2b28753e7 refactor: route more test seams through public plugin APIs 2026-03-27 13:46:17 +00:00
Peter Steinberger
a10763e118 refactor: generate bundled channel seams 2026-03-27 13:46:16 +00:00
Peter Steinberger
9a775aa59c refactor: continue plugin seam cleanup 2026-03-27 13:46:16 +00:00
Peter Steinberger
7dd196ed74 fix: apply live model switches during active retries 2026-03-27 12:01:55 +00:00
mappel-nv
9d58f9e24f Replace killProcessTree references to shell-utils with process/kill-tree (#55213)
* Replace killProcessTree references to shell-utils with process/kill-tree

* Address grace timeout comment

* Align with existing process kill behavior

* bash: fail stop without pid

* bash: lazy-load kill tree on stop

---------

Co-authored-by: Jacob Tomlinson <jtomlinson@nvidia.com>
2026-03-27 11:25:56 +00:00
Peter Steinberger
a1f995053e refactor: migrate more boundary parsing to zod 2026-03-27 05:07:50 +00:00
Tak Hoffman
d81b5fc792 Fix status subagent ownership parity 2026-03-26 22:40:50 -05:00
scoootscooob
cc359d4c9d fix: use runtime model and per-agent thinking defaults in status (thanks @scoootscooob, @xaeon2026, @ysfbsf) (#55425)
Merged via squash.

Prepared head SHA: 061d7c7ac0
Co-authored-by: scoootscooob <167050519+scoootscooob@users.noreply.github.com>
Co-authored-by: scoootscooob <167050519+scoootscooob@users.noreply.github.com>
Reviewed-by: @scoootscooob
2026-03-26 17:49:21 -07:00