Commit Graph

168 Commits

Author SHA1 Message Date
Peter Steinberger
b85b1c68d1 Refactor file access to use fs-safe primitives (#78255)
* refactor: use fs-safe primitives across file access

* fix: preserve invalid managed npm manifests

* fix: keep fs seams for startup metadata
2026-05-06 05:03:11 +01:00
Peter Steinberger
538605ff44 [codex] Extract filesystem safety primitives (#77918)
* refactor: extract filesystem safety primitives

* refactor: use fs-safe for file access helpers

* refactor: reuse fs-safe for media reads

* refactor: use fs-safe for image reads

* refactor: reuse fs-safe in qqbot media opener

* refactor: reuse fs-safe for local media checks

* refactor: consume cleaner fs-safe api

* refactor: align fs-safe json option names

* fix: preserve fs-safe migration contracts

* refactor: use fs-safe primitive subpaths

* refactor: use grouped fs-safe subpaths

* refactor: align fs-safe api usage

* refactor: adapt private state store api

* chore: refresh proof gate

* refactor: follow fs-safe json api split

* refactor: follow reduced fs-safe surface

* build: default fs-safe python helper off

* fix: preserve fs-safe plugin sdk aliases

* refactor: consolidate fs-safe usage

* refactor: unify fs-safe store usage

* refactor: trim fs-safe temp workspace usage

* refactor: hide low-level fs-safe primitives

* build: use published fs-safe package

* fix: preserve outbound recovery durability after rebase

* chore: refresh pr checks
2026-05-06 02:15:17 +01:00
Peter Steinberger
2ead1502c9 feat: route outbound sends through durable lifecycle 2026-05-06 01:46:42 +01:00
Peter Steinberger
8bfabd6bb1 feat: add channel message lifecycle sdk 2026-05-06 01:46:42 +01:00
Peter Steinberger
d94e7f5114 fix(discord): show reasoning text in progress drafts (#78050)
* fix(discord): show reasoning text in progress drafts

* fix(discord): handle reasoning progress snapshots

* test: isolate usage-format models fixture
2026-05-05 21:57:00 +01:00
Peter Steinberger
35da7d2c99 refactor: remove legacy agent dir resolver 2026-05-05 20:07:49 +01:00
Marvinthebored
a64b30705f fix(usage): serve usage from durable transcript aggregate cache
Serve usage.cost and sessions.usage from a durable transcript aggregate cache with guarded refreshes, cache-status UI localization, and regression coverage. Thanks @Marvinthebored.
2026-05-03 20:04:26 +01:00
Peter Steinberger
4fff25438c fix: propagate stream timeout abort reason (#76633) 2026-05-03 13:21:02 +01:00
mkdev11
ffd3dfa4f5 fix agents stream timeout heartbeat 2026-05-03 13:21:02 +01:00
Josh Avant
ba31afb099 fix(discord): surface stalled transport health (#76327)
* fix(discord): surface stalled transport health

* fix(discord): surface stalled transport health

* fix(discord): surface stalled transport health

---------

Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
2026-05-02 22:33:19 -05:00
Peter Steinberger
9cbd07a9bf fix: include fetch timeout context in console logs 2026-05-02 02:38:10 +01:00
Peter Steinberger
42d73fd955 refactor: remove dead private helpers 2026-05-01 06:55:26 +01:00
Kevin Lin
f351961173 fix: log fetch timeout aborts (#73692)
* fix: log fetch timeout aborts

* fix: redact relative timeout urls
2026-04-28 11:36:10 -07:00
Ke Wang
a253660385 fix(gateway): accept heartbeat/cron/webhook channel hints in agent params (#73237) (#73282)
* fix(gateway): accept heartbeat/cron/webhook channel hints in agent params (#73237)

* test(gateway): cover internal reply channel hints

* test(openai): include codex mini catalog expectation

* test(openai): follow codex catalog fixture split

---------

Co-authored-by: Ke Wang <ke@pika.art>
Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-04-28 07:32:23 +01:00
Peter Steinberger
e27c32b9b0 refactor(plugin-sdk): publish route helpers 2026-04-28 01:13:01 +01:00
Peter Steinberger
3876682635 refactor(channels): centralize route normalization 2026-04-28 01:13:00 +01:00
hcl
fd74fc5a4f fix(heartbeat): clamp scheduler delay to Node setTimeout cap (#71414) (#71478)
* fix(heartbeat): clamp scheduler delay to Node setTimeout cap (#71414)

When `agents.defaults.heartbeat.every` resolves to >2_147_483_647 ms
(~24.85d), the previous scheduleNext() called setTimeout with the raw
delay. Node clamps any delay > 2^31-1 to 1 ms, fires the callback, and
the heartbeat re-arms with the same oversized value - a tight loop that
floods the log with TimeoutOverflowWarning and crashes the gateway with
exit code 1.

Clamp the computed delay to HEARTBEAT_MAX_TIMEOUT_MS (2_147_483_647)
before calling setTimeout. The worst case is now one heartbeat every
~24.85d instead of crash-loop. Warn once per process when clamping
fires, so a misconfigured "365d" remains visible without flooding.

This is a defense-in-depth fix at the scheduler layer; loadConfig-level
rejection is a broader change with more blast radius and a separate
question (some users may legitimately want "every: 365d" to mean
"effectively never"). The clamped behaviour is closer to that intent
than the crash is.

Test: new scheduler test sets heartbeat.every="365d" with fake timers,
advances 60s, and asserts runSpy was never called (with the bug, it
would be called ~60_000 times).

* style: format heartbeat scheduler clamp

* fix: share safe timeout delay clamp (#71478) (thanks @hclsys)

---------

Co-authored-by: Peter Steinberger <steipete@gmail.com>
2026-04-25 10:03:43 +01:00
Peter Steinberger
596b88986d chore: apply core lint cleanups 2026-04-23 05:30:49 +01:00
Val Alexander
43a941b51c fix(pair): render /pair qr as media (#70047)
* fix(pair): render pair qr as media

* fix(gateway): preserve media reply threading

* fix(gateway): harden webchat media replies

* fix(plugin-sdk): keep trustedLocalMedia internal

* docs(changelog): note pair qr media fix

* Update CHANGELOG with recent fixes and enhancements

Updated changelog to include recent fixes and enhancements.
2026-04-22 03:31:09 -05:00
Peter Steinberger
0c26623a96 fix: correct tiered model pricing costs 2026-04-21 03:48:25 +01:00
Sliverp
b938e6398b feat: add tiered model pricing support (#67605)
Adds tiered model pricing support for cost tracking, keeps configured pricing ahead of cached catalog values, and includes latest Moonshot Kimi K2.6/K2.5 cost estimates.\n\nThanks @sliverp.
2026-04-21 03:02:57 +01:00
Peter Steinberger
45381135df refactor: share conversation target normalization 2026-04-19 05:02:03 +01:00
Peter Steinberger
8bfa06e992 refactor: enforce plugin-owned channel boundaries 2026-04-18 22:48:27 +01:00
Vincent Koc
b6abd68a29 perf(channels): split hot-path message channel normalization 2026-04-13 18:22:12 +01:00
Vincent Koc
96a6f55da8 perf(utils): isolate message channel normalization 2026-04-13 17:34:46 +01:00
Peter Steinberger
d6bb36730b fix(agents): stabilize subagent lifecycle 2026-04-12 16:07:46 +01:00
Vincent Koc
61da711b1a fix(cycles): split provider runtime model types 2026-04-11 22:50:45 +01:00
Vincent Koc
2028fd53f0 fix(utils): split delivery context shared types 2026-04-11 17:03:38 +01:00
Vincent Koc
81535d394d fix(cycles): repair broken type surfaces 2026-04-11 13:42:17 +01:00
Vincent Koc
543c14a4ed fix(cycles): split runtime delivery and registry seams 2026-04-11 13:26:50 +01:00
Vincent Koc
74e7b8d47b fix(cycles): bulk extract leaf type surfaces 2026-04-11 13:26:50 +01:00
Peter Steinberger
9fd08f9d0f refactor: remove type-only import cycles 2026-04-10 15:14:27 +01:00
Peter Steinberger
bbede259b7 test(delivery): keep telegram parent channel target expectation 2026-04-10 10:12:07 +01:00
Peter Steinberger
feb3c7f823 fix(test): repair rebased gate failures 2026-04-10 10:12:07 +01:00
Peter Steinberger
a5de4a1a50 test: align telegram delivery context expectation 2026-04-10 09:47:57 +01:00
Peter Steinberger
67ede66b3e test: refresh latest main expectations 2026-04-10 09:47:57 +01:00
Peter Steinberger
1d310e2ab0 fix: restore main verification gates 2026-04-10 09:34:50 +01:00
Guangchi Yuan
110782a26a fix(gateway): preserve thread routing in delivery context for Slack/Telegram/Mattermost (#54840)
Merged via squash.

Prepared head SHA: 34bedac747
Co-authored-by: yzzymt <6908291+yzzymt@users.noreply.github.com>
Co-authored-by: jalehman <550978+jalehman@users.noreply.github.com>
Reviewed-by: @jalehman
2026-04-09 14:26:41 -07:00
Peter Steinberger
bbcc95948e refactor: dedupe provider lowercase helpers 2026-04-07 15:53:50 +01:00
Peter Steinberger
55f07e0381 refactor: dedupe shared string normalizers 2026-04-07 11:18:18 +01:00
Peter Steinberger
74ea9de6f2 refactor: dedupe reply lowercase helpers 2026-04-07 10:37:39 +01:00
Peter Steinberger
434d56a948 refactor: dedupe lowercase helper readers 2026-04-07 10:37:39 +01:00
Peter Steinberger
5eb6921a18 refactor: dedupe outbound helper readers 2026-04-07 08:40:35 +01:00
Peter Steinberger
2197ce62bd refactor: dedupe lower-parser readers 2026-04-07 08:40:34 +01:00
Peter Steinberger
a5991e8017 refactor: dedupe approval and routing readers 2026-04-07 07:36:11 +01:00
Peter Steinberger
1dea64ab99 refactor: dedupe provider reader helpers 2026-04-07 06:42:34 +01:00
Peter Steinberger
21802f750f refactor: dedupe conversation string readers 2026-04-07 06:07:13 +01:00
Peter Steinberger
134ff61754 test: stabilize agent auth and config suites 2026-04-06 19:52:42 +01:00
Peter Steinberger
26a5ab1c6f fix(utils): harden directive block placeholders 2026-04-06 15:11:44 +01:00
szx007
af7c21f207 fix: preserve code block indentation in normalizeDirectiveWhitespace
## Summary

- Problem: `normalizeDirectiveWhitespace` applied whitespace-collapsing regexes globally, including inside fenced code blocks (` ``` ` / `~~~`) and indent-code-blocks (4-space / tab), corrupting indentation in assistant replies that contain code snippets
- Why it matters: Any language where indentation is significant (Python, Go, YAML, etc.) or visually meaningful would render incorrectly after stripping inline directive tags
- What changed: Stash code blocks under a Unicode private-use sentinel (`\uE000`) before normalization, run the existing prose regexes on the masked text, then restore the original blocks verbatim
- What did NOT change: All prose normalization rules are retained as-is (`\r\n`, multi-space collapse, leading blank-line strip, trailing whitespace, 3+ newline fold)

## Change Type

- [x] Bug fix

## Scope

- [ ] Gateway / orchestration

## Root Cause

- Root cause: Prose whitespace regexes were applied to the full text string with no awareness of Markdown code block boundaries
- Missing detection / guardrail: No tests covered indented content inside fenced blocks
- Contributing context: Directive tag stripping (`[[reply_to_current]]`, `[[audio_as_voice]]`) is applied before delivery, making the normalization step a silent corruption point for code-heavy replies

## Regression Test Plan

- Coverage level that should have caught this:
  - [x] Unit test
- Target test or file: `src/utils/directive-tags.test.ts`
- Scenario the test should lock in: `parseInlineDirectives` with fenced/indent code blocks must preserve all leading whitespace inside those blocks
- Why this is the smallest reliable guardrail: Pure function with deterministic string in/out; no mocks needed
- If no new test is added, why not: 7 new unit tests added

## User-visible / Behavior Changes

Code blocks in assistant replies containing `[[reply_to_current]]` or `[[audio_as_voice]]` directives now retain correct indentation after the directive is stripped.

## Security Impact

- New permissions/capabilities? No
- Secrets/tokens handling changed? No
- New/changed network calls? No
- Command/tool execution surface changed? No
- Data access scope changed? No

## Compatibility / Migration

- Backward compatible? Yes
- Config/env changes? No
- Migration needed? No

Co-Authored-By: Codemax <codemax@binance.com>
2026-04-06 15:11:44 +01:00