Skip to content

Follow omp session names in Telegram topics and add owner-only /rename - #84

Open
w0330t wants to merge 2 commits into
TerrifiedBug:masterfrom
w0330t:topic-session-name
Open

w0330t wants to merge 2 commits into
TerrifiedBug:masterfrom
w0330t:topic-session-name

Conversation

@w0330t

@w0330t w0330t commented Oct 11, 2026

Copy link
Copy Markdown

Motivation

The existing herdr/directory-based topic titles identify where a session runs, but not what the conversation is about. Auto-generated omp titles and local session renames can therefore leave Telegram topics indistinguishable or stale. This makes it harder to find the right session without opening each topic.

Behavior

  • Topic names prefer pi.getSessionName(), with the existing herdr agent name → space label → directory fallback when the session is unnamed.
  • Display names normalize whitespace and fit within 32 code points, including the ellipsis and collision suffix. Truncation prefers a word boundary after at least 20 code points and preserves CJK characters and emoji graphemes. The full omp session name is not truncated.
  • Names synchronize after topic claim/adoption, on each agent_end, and through an unref'd 30-second comparison. Unchanged names do not call Telegram. TOPIC_NOT_MODIFIED is treated as success; failures warn once per failed name and retry on a subsequent check. Live collisions retain the existing -pid suffix convention within the display cap.
  • Add /telegram topics names session|space, alongside topics tidy, persisted as topicsNames and defaulting to session. Switching to space restores each owned topic's 0.14.0 herdr agent → space label → folder-derived name once at the next check. After restoration there are no more topic edits or name-sync interval work in space mode. A settings-file watcher lets all live owning sessions react to switches, including returning to session, without restarting. Current mode appears in topics status and topics names [status]. No naming key remains in the generic /telegram set schema.
  • Add /rename <name> for the paired owner's private session topic. It calls pi.setSessionName, never submits an agent prompt, and collapses whitespace without capping the stored session name. Bare /rename shows the current name and usage; control/unowned topics show usage only, and non-owners cannot rename sessions. The command accepts the @botname suffix.
  • /rename changes the omp session in both modes. In space mode its reply says the topic keeps the space name and points to /telegram topics names session.
  • Update the scoped command menu, help, README, and guide.

Compatibility and default choice

The topic registry format, session/herdr resume identities, topic ownership, and message routing are unchanged. An old standalone daemon still forwards /rename unchanged to updated live sessions; existing sessions must be exited/resumed locally to load the new extension. A daemon restart is only needed to refresh the menu, help, and control/unowned-topic usage handling.

This branch chooses session as the default so the new naming behavior is immediately useful. Upstream may prefer space as the default for a more conservative rollout; the topics naming command makes that choice explicit.

No version bump was made. The repository has no unreleased changelog section or PR template.

Validation

  • bun install: passed; bun install --frozen-lockfile: passed.
  • bun run check: rerun after the topics naming-command revision — TypeScript typecheck and all 481 tests passed (0 failures).
  • The following package/host checks passed on the earlier branch revision, before the naming switch moved under /telegram topics; only bun run check was rerun for that revision as requested.
  • bun run smoke:package: passed with npm 11 supplied using npm exec --yes --package=npm@11 -- bun run smoke:package.
  • bun run check:host -- 18.1.16: passed with npm 11; resolved host 18.1.16.
  • bun run check:host -- latest: passed with npm 11; resolved host 18.8.9.
  • Focused coverage includes word-boundary/CJK/emoji truncation, exactly-32-code-point names, changed/unchanged synchronization, TOPIC_NOT_MODIFIED, failure retries, collisions, persisted topics naming modes, one-time space restoration and retry, cross-session settings-file switches without a restart, command validation/status/completions, owner/bare/non-owner/control/unowned /rename, the bot-name suffix, unchanged daemon forwarding, and the real extension session API in both modes.
  • No lint/format scripts or CI lint/format job are configured.

The system npm 12 changes npm pack --json from an array to a keyed object, which the existing package smoke runner does not accept. Using npm 11 restored the runner's expected output without changing unrelated upstream scripts.

Read-only live evidence

For session 01a12072-d179-760e-95e3-6e3dc9e68e85, registry thread 5504254 stores tg 相关; its last JSONL title_change also records tg 相关 (2026-10-11T00:28:52.904Z). Both match after normalization/capping (5 code points). This is evidence from the previously patched installed bridge, not a deployment of this branch. Nothing under ~/.omp was modified and no live process was restarted.

Local commits

  1. dfb7057 — Follow omp session names in Telegram topics (including /telegram topics names session|space).
  2. ea1ae96 — Add owner-only Telegram session rename command.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant