@ycodium-ai/plugin-im 0.2.2566 → 0.2.2578

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -30,18 +30,32 @@ is HTTP long-polling.
30
30
  The default is one message per finished turn. A single turn can produce dozens
31
31
  of assistant messages, mostly commentary between tool calls.
32
32
 
33
- On Lark, the reply to a thread this plugin opened is one card that is patched
34
- as the agent works (`thread.turn-progress` ticks, reply text read with
35
- `getThreadMessage`) and settled when the turn ends; threads opened elsewhere
36
- still get the per-turn or per-message text. Platforms that cannot edit a sent
37
- message keep sending text. Approval cards are posted for every pending request
38
- and replaced with a settled notice when the request is answered, here or
39
- elsewhere (`thread.request-resolved`). Cards that were still open when the
40
- plugin restarted are marked interrupted. The card pieces are pure and
41
- separate: `turnView.ts` (ticks to a view model), `larkCards.ts` (view model
42
- to card JSON), `larkMarkdown.ts`, `larkCardStream.ts` (throttle, one patch in
43
- flight, newest snapshot wins), `turnCards.ts` (per-thread queue and card
44
- lifecycle).
33
+ The reply to a thread this plugin opened is written as the agent works
34
+ (`thread.turn-progress` ticks, reply text read with `getThreadMessage`) and
35
+ settled when the turn ends; threads opened elsewhere still get the per-turn or
36
+ per-message text. How depends on the platform:
37
+
38
+ - **Lark** patches one card.
39
+ - **Telegram** edits one message (`editMessageText`, plain text) and, when the
40
+ reply outgrows a single message, freezes it and continues in the next one.
41
+ A `message is not modified` answer counts as success; a 429 waits the
42
+ `retry_after` it names, once.
43
+ - **WeCom** keeps sending frames of one `stream.id` (`finish: false`) on the
44
+ inbound message's `req_id` and closes with `finish: true`. With no inbound
45
+ message to reply to, or after the platform rejects the stream, the settled text
46
+ goes out as ordinary messages instead.
47
+
48
+ An adapter opts in with the optional `turnCards` surface (`src/adapter.ts`).
49
+ Approval messages are posted for every pending request on platforms with
50
+ buttons and replaced with a settled notice when the request is answered, here or
51
+ elsewhere (`thread.request-resolved`); WeCom, which answers by number, posts only
52
+ the first and just stops accepting its number. Cards that were still open when the
53
+ plugin restarted are marked interrupted. The pieces are pure and separate:
54
+ `turnView.ts` (ticks to a view model), `larkCards.ts` (view model to card JSON),
55
+ `larkMarkdown.ts`, `larkCardStream.ts` (throttle, one update in flight, newest
56
+ snapshot wins), `turnCards.ts` (per-thread queue and lifecycle),
57
+ `plainTurnText.ts` (view model to plain text), `telegramTurn.ts` (message
58
+ rollover).
45
59
 
46
60
  A group keeps its place across restarts. Which thread a group is talking in, the
47
61
  team it is pointed at, the model and plan mode set from the group, the threads
@@ -51,10 +65,20 @@ written as plugin facts (`ctx.events.append`) and folded back by a pure function
51
65
  archived or moved to another project is dropped on the next message.
52
66
 
53
67
  Chat commands: `/stop`, `/status`, `/new`, `/sessions`, `/resume`, `/model`,
54
- `/plan`, `/team`, `/thread`, `/help`. `/sessions` and `/resume` only list and
68
+ `/plan`, `/team`, `/thread`, `/help`, `/panel`. `/sessions` and `/resume` only list and
55
69
  switch threads this plugin opened, since the host lets a plugin send only into
56
70
  its own threads.
57
71
 
72
+ On Lark and Telegram, `/panel` sends a command panel (`/help` stays text and ends with a pointer to it; on WeCom, which has no panel, it does not): every command above
73
+ is a button (a card on Lark, an inline keyboard on Telegram), and the ones that take an argument (a thread, a team, a model) open
74
+ a second view on the same message with a Back button. Telegram buttons carry only
75
+ a short `pn:<version>:<index>` token (`callback_data` is capped at 64 bytes);
76
+ the action stays in memory and a tap on an older keyboard version counts as expired. Each card keeps its own view
77
+ stack in memory (`src/panelController.ts`), so after a restart an old card only
78
+ answers that it has expired. A tap runs the same handler as the typed command and
79
+ waits in the same per-group queue as typed messages. Another platform opts in by
80
+ implementing the optional `panel` surface on its adapter (`src/adapter.ts`).
81
+
58
82
  The **Reply language** setting (Chinese by default, or English) picks the
59
83
  language of everything the bot says itself. The settings card follows the
60
84
  interface language instead. The copy lives in `locales/en.json` and