@relaymessenger/pi 0.1.4-staging.34 → 0.1.4-staging.36

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
@@ -18,7 +18,9 @@ Set `RELAY_AGENT_TOKEN` before using `/relay-connect`. Set
18
18
 
19
19
  ## Selection
20
20
 
21
- End the final Pi answer with a `selection` JSON fence after the question.
21
+ End the final Pi answer with a `selection` JSON fence holding the question as
22
+ `title` (1 to 60 characters) and the `options`; any words outside the fence go
23
+ as a normal message above the card.
22
24
  The RPC prompt preserves ordered rich parts, `selected_values`, and `reply_to`
23
25
  as data. FULL sync still fails closed rather than discarding skipped context.
24
26
 
package/dist/index.js CHANGED
@@ -179,6 +179,17 @@ export class PiChannel {
179
179
  const messages = answerMessages(answer);
180
180
  if (messages[0]?.error)
181
181
  console.error(`Relay: the component block in pi's answer was left as text: ${messages[0].error}.`);
182
+ // An answer to another agent replies to its Message, as a bot's reply
183
+ // names the message it answers (Telegram `reply_to_message_id`); Relay's
184
+ // A2A door gives a calling agent the reply that names its message. A
185
+ // person's Message is not named, so the chat looks as it always has. An
186
+ // agent may not reply to buttons or a selection, and a reply names part 0.
187
+ // Turns in one chat already run one after another, so an agent's two
188
+ // messages each get their own answer.
189
+ const opening = data.parts[0]?.type;
190
+ const replyTo = data.sender_handle.kind === "agent" && opening !== "buttons" && opening !== "selection"
191
+ ? { reply_to: { message_id: data.id } }
192
+ : {};
182
193
  for (const [index, message] of messages.entries()) {
183
194
  const key = `pi-${event.event_id}-${index}`;
184
195
  let parts = message.parts;
@@ -193,7 +204,7 @@ export class PiChannel {
193
204
  continue;
194
205
  }
195
206
  }
196
- await this.#relay.chats.messages.send(data.chat.id, { message: { parts, idempotency_key: key } });
207
+ await this.#relay.chats.messages.send(data.chat.id, { message: { parts, idempotency_key: key, ...(index === 0 ? replyTo : {}) } });
197
208
  }
198
209
  }
199
210
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@relaymessenger/pi",
3
- "version": "0.1.4-staging.34",
3
+ "version": "0.1.4-staging.36",
4
4
  "description": "Relay Messenger channel for Pi over Relay v1 WebSocket delivery.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "test": "vitest run"
35
35
  },
36
36
  "dependencies": {
37
- "@relaymessenger/sdk": "0.3.6-staging.34"
37
+ "@relaymessenger/sdk": "0.3.6-staging.37"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@earendil-works/pi-coding-agent": "0.86.0",