43 Commits

Author SHA1 Message Date
Bingxi Zhao (Frank)
920706a55b Merge #2348 from rudycelekli 2026-11-06 01:56:24 +08:00
Rudy Celekli
472e386f58 fix(partners): drop <style>/<script> bodies in email HTML-to-text
_html_to_text stripped only tags, so the CSS/JS inside <style>/<script>
blocks leaked into the plain text fed to the model (and could push the
real message past the body truncation limit). Remove those blocks whole
before the tag strip.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-11-02 01:12:06 -05:00
RRFZ
4838e77387 fix(partners): name only the file when Telegram media fails to send
When a media attachment cannot be sent, the Telegram channel tells the
chat "[Failed to send: <name>]", taking the name with
media_path.rsplit("/", 1)[-1]. A Windows server's path has no "/", so
the chat received the server's full local path instead, exposing the
account name and directory layout to everyone in the chat.

Use Path(media_path).name, as the WeChat channel already does.
2026-10-31 21:25:46 -04:00
Bingxi Zhao (Frank)
fbab59acbf feat: modularize installation and enforce feature dependency boundaries 2026-10-28 01:02:29 +08:00
Bingxi Zhao (Frank)
6bbcc00c55 Merge dev into preview, preserving preview features
Integrate dev fixes with preview's Python/TypeScript schedulers, chat queue, learning navigation, and live turn persistence.
2026-10-27 01:16:58 +08:00
Bingxi Zhao (Frank)
399297e7f0 feat: preserve TypeScript engine migration and workspace updates 2026-10-18 23:09:10 +08:00
dajiaohuang
af8e89a728 Merge commit '6cf793bd868ba5ecbe64722936d4be8fab5a01df' into fix/dingtalk-delivery-retry 2026-10-08 12:35:41 +08:00
dajiaohuang
f046417500 fix(partners): retain failed channel deliveries for retry 2026-10-08 12:35:41 +08:00
evan188199-tech
6be5e6e068 fix(partners): stop telegram typing loop for denied senders and dropped media-group stragglers (#1746)
* test(partners): telegram message parsing, chunking and typing contract suite

Red-first coverage for deeptutor/partners/channels/telegram.py (coverage
gap: 418 missing / 30.2%). 28 green tests pin current behavior; 2 red
tests encode real defects for a fix card:

1. media-group straggler arriving while _flush_media_group dispatches is
   buffered but never flushed (message dropped, buffer leaks)
2. typing indicator for an ACL-denied sender runs forever

No product code changed. Evidence in evidence/telegram-tests-20261003/.

* fix(partners): stop telegram typing loop for denied senders and dropped media-group stragglers

- start the typing indicator only for senders passing is_allowed: a
  denied sender never receives a reply, so the 4-second send_chat_action
  loop used to run until channel restart
- release the media-group task slot before dispatching the buffered
  album, so a straggler item arriving mid-dispatch schedules its own
  follow-up flush instead of being silently dropped (and leaking its
  buffer); the finally guard only drops the task's own registration

* test(partners): telegram suite lint polish; drop internal evidence dir

- fix ruff F541 (redundant f-string) and apply ruff format
- reword red-test docstrings: both defects are fixed on this branch
- remove evidence/telegram-tests-20261003/ (internal tracking artifacts,
  kept on the v1 branch) so the tree matches upstream conventions

---------

Co-authored-by: XZH <cto@xzh.ai>
2026-10-07 20:21:46 +08:00
evan188199-tech
58b3f54c36 test(partners): lock outbound dispatch timeout semantics (#1763)
_dispatch_outbound's 'except asyncio.TimeoutError: continue' is the 1s
idle-poll timeout on an empty outbound queue, not a message skip: a
cancelled Queue.get() pops nothing and a consume finishing despite the
timeout has its result returned by wait_for. Channel send timeouts are
Exception subclasses retried inside _send_with_retry (backoff 1s/2s/4s,
send_max_retries attempts) and logged on give-up. Document this on the
handler and lock it with focused tests (idle poll then deliver, send
timeout retried in-dispatch, retries exhausted after max attempts).

Co-authored-by: XZH <cto@xzh.ai>
2026-10-07 20:12:16 +08:00
Bingxi Zhao
a289eb03f7 Merge pull request #1677 from nextnowlabs/main
fix(partners): keep IM replies in step with the turn
2026-10-04 14:19:16 +08:00
Bingxi Zhao (Frank)
58e4601b52 Merge dev into PR #1687 and preserve integrated behavior 2026-10-04 14:18:47 +08:00
XZH
faac4ec7a3 feat(partners): add Telegram per-chat response policies (#1667) 2026-10-01 17:47:53 -07:00
zhujia
d1fe4f637d fix(feishu): keep replies in step with the turn
The channel trailed the model by up to 20s and finished long after the WebUI.
Every sync SDK call opened a fresh connection (DNS + TCP + TLS ≈2s per call)
and the serial outbound lane paid it per message.

- route lark-oapi's sync calls through one keep-alive session per worker
  thread: measured 2.03s → 0.68s per call (0.55s warm)
- create the streaming card carrying its first text instead of pushing that
  text in a second API call
- ask CardKit for a printable pace (streaming_config) instead of the platform
  default of one character per 70ms
- stop retrying card creation on every delta; after three failures the reply
  falls back to a regular card instead of dribbling out
- throttle stream edits to 1s so the lane stays ahead of the model
- make group threading configurable, and always reply flat in single chats
- post a brief "thinking…" notice while the model reasons and retract it once
  the answer starts: reasoning events never reach a channel, so such a turn
  used to look dead
- close the SDK WebSocket client on stop, so a reload cannot leave a second
  listener subscribed to the same app
2026-09-30 16:25:08 +08:00
zhujia
1c1dc61fea fix(partners): merge queued outbound messages before delivery
A partner has one outbound lane and every channel send is a blocking HTTP
round trip, so a fast model filled the queue faster than Feishu could post:
readers kept receiving an answer long after the turn had finished.

- share the dispatcher's delta/progress coalescing with the live router and
  keep message order through a pending queue
- merge queued narration and tool hints, which otherwise cost one API call
  each
- retry ordinary messages with the configured budget, but never hold the lane
  behind backoff sleeps for stream frames, which self-heal
- keep the lane alive when a single message fails, and follow a channel
  reload
- stamp publish time on the bus and warn when delivery waits too long, so a
  trailing reply is visible in the logs
2026-09-30 16:24:51 +08:00
Hui
7fdadd76cf fix(partners): render every fenced code block as code in Telegram HTML
The Telegram converter protected code with ```[\w]*\n?([\s\S]*?)```,
so an info string such as c++ left "++" as the first code line, a ~~~
block was formatted as prose ("# setup" lost its hash, __init__ became
bold "init"), and a ```` fence showing a ``` example closed at the inner
fence, leaving an empty <pre> and the example leaking out as text.

Replace fenced blocks line by line first: open on ``` or ~~~ and close
on a bare run of the same character that is at least as long. One-line
```code``` and unclosed fences keep the previous regex handling. The
streaming preview strips fences through the same helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 21:09:54 -04:00
Bingxi Zhao (Frank)
8b0ae3891f fix(feishu): keep model picker selectable and avoid callback deadlock 2026-09-23 12:44:11 +08:00
Bingxi Zhao (Frank)
44a76ed0a9 feat(partners): add provider-first Feishu model picker 2026-09-23 12:37:45 +08:00
Bingxi Zhao (Frank)
0843e7d518 fix(feishu): dispatch card actions on supported WebSocket SDKs 2026-09-23 12:18:43 +08:00
Bingxi Zhao (Frank)
f14e8e065d feat(feishu): deliver threaded replies and private model picker (#1517) 2026-09-23 12:08:17 +08:00
Bingxi Zhao (Frank)
3dc372f551 release: v1.6.2 — immersive watching and extensible visualizers
Add synchronized YouTube learning, a plugin-driven visualizer catalog, and Hermes, OpenClaw, and DeepSeek agent harnesses. Refresh Reading, Knowledge, Partner status, guided updates, documentation, translations, and release notes for v1.6.2.
2026-08-31 01:13:07 +08:00
zh769394
61a32bd626 fix: improve Windows cross-platform compatibility across runner, tools, and tests
- Guard resource module import in runner server for non-POSIX platforms
- Use POSIX relative path format in ListDirTool for consistent path separators
- Specify UTF-8 encoding in Weixin channel state loading and prompt tests to avoid GBK UnicodeDecodeError
- Use as_posix() in path assertion tests for cross-platform compatibility
2026-08-26 00:29:52 +08:00
Bingxi Zhao (Frank)
bd80a4d28a release: v1.5.17
Partners stop being a deployment-wide admin resource and become
per-user: three nested rights (manage / use / neither) replace the
blanket admin gate on the router, each member can build and own their
own, and every person's conversations with a partner stay private to
their account. Grants keep working and now offer only admin-managed
partners. Channel runtime state moves from one directory per channel to
one per partner — copied, not moved, and only when its owner is
unambiguous — so two partners can finally run the same channel.

Around that: a knowledge base can track GitHub repositories and re-sync
their Markdown (#903); Antigravity CLI joins My Agents now that Gemini
CLI is retired (#828); personal WeChat signs in from a QR code drawn in
the browser instead of the server log (#951); a chat account can be
linked to a DeepTutor account with /link; containers re-apply the extras
they declare instead of losing them at compose down (#762); and
`deeptutor doctor` answers whether a workspace is ready to run (#959).

Reliability, largely from community PRs: embeddings survive a
rate-limited provider through key rotation, a retry budget and a global
throttle (#962); MinerU parsing and code execution work on Windows
(#844, #964); indexing fails bounded instead of hanging (#946); MinerU
page-layout blocks stop being indexed as content (#949); voice uploads
carry a MIME the transcription API accepts (#945); and reasoning effort
can be overridden per conversation (#641).

Release plumbing: notes in assets/releases/ver1-5-17.md, v1.5.13
archived, __version__ 1.5.17, README Releases row and all eleven
translations synced.

Two defects found by the release gate and fixed here:

- Six partner routes — the four channel-onboarding endpoints and both
  WeChat QR endpoints — kept the _auth-only mount they had inherited
  from the blanket admin gate, so any signed-in account could start a
  QR login for someone else's partner and write a bot token into its
  channel config. All six now declare _MANAGEABLE, and a sweep test
  asserts no {partner_id} route is left ungated.
- A configured api_key became `str | list[str]` when key rotation
  landed, but ten call sites pass it somewhere that takes one key; a
  list would have rendered into an Authorization header verbatim.
  keypool.primary_api_key reduces at each boundary.

Gates: pre-commit (all 15 hooks), ruff check + format, pytest
5276 passed, web 605 node tests, docs build.
2026-08-25 02:24:35 +08:00
evan188199-tech
ec4ee2356a feat(partners): add QR channel onboarding (#952)
Co-authored-by: XZH <cto@xzh.ai>
2026-08-24 16:34:29 +08:00
Bingxi Zhao
1cc27028f6 fix: isolate invalid Partner channel configs (#827)
Reject newly saved enabled channels with empty allow lists, and safely skip only legacy-invalid channels at startup while preserving deny-by-default behavior and all other Partner services.
2026-08-16 23:15:05 +08:00
Bingxi Zhao
4f06aaa070 fix: isolate Partner data per user (#621)
Keep Partner configuration and assets shared while isolating authenticated users’ sessions, relationship memory, search, and media paths. Preserve legacy admin/IM behavior and enforce assignment checks at every access boundary.
2026-08-16 23:00:41 +08:00
Bingxi Zhao (Frank)
1667d070ec refactor(partners): unify markdown table row splitting across channels
#679/#682/#683 each fixed markdown-table cell handling in one channel, but
Slack (convert_markdown_table_to_labeled_rows) and Telegram (_render_table_box)
still split rows with str.strip("|"), which collapses leading/trailing empty
cells and shifts every column — only Feishu (#683) had the correct split.

Extract split_markdown_table_row as the single primitive and route Slack,
Telegram, and Feishu through it: fixes the same class of bug in all three and
removes three near-duplicate row splitters. Slack's separator-row detection now
reuses is_markdown_table_separator_row instead of an ad-hoc regex.

Also fixes the #679 helpers-import ordering and formats the #679/#683 test
files that squash-merge did not run through ruff format.
2026-07-24 16:19:35 +08:00
Santh
68de93f66e fix(partners): keep empty cells when converting Slack markdown tables (#679)
Blank cells were dropped by a truthiness filter, so columns disappeared from the Slack rendering.

Co-authored-by: Bingxi Zhao (Frank) <13051345080@163.com>
2026-07-24 16:09:55 +08:00
Santh
968921b135 fix(partners): do not treat empty markdown rows as table separators (#682)
all([]) is True in Python, so a blank table row was treated as a separator.
2026-07-24 16:04:59 +08:00
Santh
87d243d747 fix(partners): keep empty edge cells in Feishu markdown tables (#683)
strip("|") collapsed leading/trailing empty cells, so ||Name|Age| lost a column and shifted row values.
2026-07-24 16:04:53 +08:00
Bingxi Zhao
307d4352b6 Merge pull request #670 from santhreal/fix/safe-filename-strip-controls
fix(partners): strip control chars in safe_filename
2026-07-23 22:30:23 +08:00
santhreal
240ad1afbe fix(partners): strip control chars in safe_filename
Embedded null bytes survived sanitization and made path.write_bytes raise
ValueError on partner attachment uploads. Strip controls and collapse
dot-only names, matching DocumentValidator posture.
2026-07-22 22:49:07 -07:00
santhreal
b10089741a fix(partners): avoid hang in split_message when max_len <= 0
When max_len is 0 or negative, the cut pointer never advances and split_message loops forever.
Return the content unsplit, matching the nanobot helpers pattern.
2026-07-18 17:13:19 -07:00
Bingxi Zhao (Frank)
9d285f1078 fix(wecom,parsing): bound the reply-frame cache; harden img_path anchoring
Follow-up to #631/#628: wecom's _chat_frames now uses the same
LRU-bounded OrderedDict idiom as the dedup cache (cap 1000) so
long-running bots can't grow it unboundedly, frame-body extraction is
deduped into one helper, and the dead _loop attribute is gone.
_absolutize_img_paths now skips non-string entries and refuses to
anchor traversal paths ('..' components) with a warning, so a crafted
content_list cannot point the vision stage outside the cache dir.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-19 01:38:06 +08:00
tianrking
8cf604577e fix(partners): align WeCom with SDK 1.0.8 2026-07-16 13:23:36 +08:00
Bingxi Zhao (Frank)
bca6f6e983 release: v1.4.15
Native Mattermost channel for Partners (issue #590): a self-hosted
Mattermost server connects through its own v4 WebSocket + REST API
instead of the Slack-compatibility shim, reusing the existing
httpx + websockets transport.

Guided Learning multiple-choice questions now register every full option
body with mastery_quiz (not bare A/B/C labels), so grading is
deterministic and the saved Question Bank entry shows the real choices;
pre-existing paths recover option text from the original ask_user card.

A configured zero chunk_overlap (or chunk_size) on the LlamaIndex engine
is no longer coerced to the default 50.

Bundles the README Releases update, translated-README channel-list sync
(10 languages), release notes (assets/releases/ver1-4-15.md), version
bump to 1.4.15, and the ruff-format of the new Mattermost channel files.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 22:33:04 +08:00
Bingxi Zhao (Frank)
4fab448977 minor fix & new channel 2026-06-30 22:11:40 +08:00
Bingxi Zhao (Frank)
1bf11d13e7 prepare 1.4.7 2026-06-18 00:22:48 +08:00
Bingxi Zhao (Frank)
452de66729 release: v1.4.3 — TutorBot→Partners, single-loop Chat, real multi-user isolation
The biggest cut since v1.4.0:

- Partners: TutorBot renamed and rebuilt on the product chat agent loop —
  production IM pipeline (retry/dedup/coalescing, per-channel delivery),
  live streaming on Telegram/Discord/Feishu, new WeCom AI Bot channel
  (15 connectors), web-chat attachments, soul template library + editor.
  Automatic non-destructive migration from data/tutorbot/; HTTP API moved
  to /api/v1/partners.
- Chat: single exploring agent loop with native tool calling; Activity
  header with collapsible thinking/tool trace.
- Multi-user: per-user grants v2 (tools/MCP/exec), data/users + data/system
  layout with automatic migration, runner mounts only the user workspace.
- Visualize: inline themed SVG, structured prompts, local validate+repair
  replacing the LLM review round.
- Co-writer Mermaid diagrams + selection RAG/web; file viewer docx/xlsx
  previews; MinerU cloud parsing backend; office skills on by default;
  CLI chat renderer rewrite.
- Docs rebuilt at deeptutor.info: per-channel setup guides (en+zh),
  refreshed screenshots.
- Pre-commit clean sweep: defusedxml for SVG validation, usedforsecurity
  flags on content hashes, mypy fixes, types-croniter stub.

Release notes: assets/releases/ver1-4-3.md

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-12 17:17:43 +08:00
Bingxi Zhao (Frank)
062f401195 feat(partners): live streaming for telegram/discord/feishu + unavailable-channel surfacing
- telegram: send_delta via progressive edit_message_text (throttled,
  flood-control retry, HTML final render, mid-stream overflow split)
- discord: send_delta via REST POST/PATCH with rate-limit retry; send()
  now raises on failure so the manager retry applies
- feishu: send_delta via CardKit streaming cards (create → sequenced
  stream updates → close streaming_mode, regular-card fallback)
- registry: discover_all_with_errors keeps import-failed channels
  diagnosable; schema API marks them available:false with the reason;
  UI grays them out and shows the missing-dependency message instead
  of silently dropping them (the "why is X missing?" class of bugs)
- 10 new streaming contract tests; 343 partner tests green; tsc clean

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 22:39:49 +08:00
Bingxi Zhao (Frank)
6d4dd15d78 update 2026-06-11 20:15:48 +08:00
Bingxi Zhao (Frank)
46093e5e2b update msg 2026-06-11 20:03:34 +08:00
Bingxi Zhao (Frank)
da1061910b feat(partners): production IM infra — retry/dedup/coalescing, per-channel delivery flags, stream-delta protocol, slack/telegram connection fixes
- manager: exponential-backoff retry (send_max_retries), origin-scoped
  duplicate suppression, _stream_delta coalescing, per-channel
  send_progress/send_tool_hints gating (global AND channel override)
- base: send_delta/supports_streaming protocol, _wants_stream injection
- runner: live stream segments per loop round (turn_id:call_id), narration
  rounds freeze on completion, final reply marked _streamed when delivered
- telegram: split API/polling HTTPX pools (pool exhaustion fix), trim
  legacy nanobot command menu, raise on send failure for manager retry
- slack: Socket Mode handshake timeout + WSS diagnostics, send raises
- schema: DeliveryOverrides/StreamingSupport mixins on channel configs
- partners/network.py: strict SSRF validator for channel media downloads
- icons: correct WeCom mark (TDesign outline, official brand palette)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-11 17:43:08 +08:00