macroclaw 0.29.0 → 0.30.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "macroclaw",
3
- "version": "0.29.0",
3
+ "version": "0.30.0",
4
4
  "description": "Telegram-to-Claude-Code bridge",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -775,6 +775,33 @@ describe("Orchestrator", () => {
775
775
  const detailResponse = responses[responses.length - 1];
776
776
  expect(detailResponse.message).toContain("Model: opus");
777
777
  });
778
+
779
+ it("shows clean prompt text for main sessions, not XML wrapper", async () => {
780
+ const claude = mockClaude((): RunningQuery<unknown> => ({
781
+ sessionId: "main-sid",
782
+ startedAt: new Date(),
783
+ result: new Promise(() => {}),
784
+ kill: mock(async () => {}),
785
+ }));
786
+ const { orch, responses } = makeOrchestrator(claude);
787
+
788
+ orch.handleMessage("I want to visit my parents at their house");
789
+ await waitForProcessing(); // Let the queue process and start the main query
790
+
791
+ orch.handleSessions();
792
+ await waitForProcessing();
793
+ const listResponse = responses[responses.length - 1];
794
+ const detailBtn = listResponse.buttons![0] as { text: string; data: string };
795
+ const sessionId = detailBtn.data.slice(7);
796
+
797
+ orch.handleDetail(sessionId);
798
+ await waitForProcessing();
799
+
800
+ const detailResponse = responses[responses.length - 1];
801
+ expect(detailResponse.message).toContain("I want to visit my parents");
802
+ expect(detailResponse.message).not.toContain("<event");
803
+ expect(detailResponse.message).not.toContain("<text>");
804
+ });
778
805
  });
779
806
 
780
807
  describe("handleKill", () => {
@@ -283,9 +283,9 @@ export class Orchestrator {
283
283
  const label = Orchestrator.#requestLabel(request);
284
284
  const name = generateName(label);
285
285
  const backgroundedName = movedToBackground ? mainInfo?.name : undefined;
286
- const prompt = this.#formatPrompt(request, name, backgroundedName);
286
+ const formatted = this.#formatPrompt(request, name, backgroundedName);
287
287
 
288
- this.#startMainQuery(name, prompt, this.#config.model);
288
+ this.#startMainQuery(name, label, formatted, this.#config.model);
289
289
  }
290
290
 
291
291
  // --- Response delivery ---
@@ -319,20 +319,20 @@ export class Orchestrator {
319
319
 
320
320
  // --- Main session query ---
321
321
 
322
- #startMainQuery(name: string, prompt: string, model: string | undefined): void {
322
+ #startMainQuery(name: string, displayPrompt: string, formatted: string, model: string | undefined): void {
323
323
  const opts = { model };
324
324
  let query: RunningQuery<AgentOutput>;
325
325
 
326
326
  if (this.#mainSessionId && this.#runningSessions.has(this.#mainSessionId)) {
327
- query = this.#claude.forkSession(this.#mainSessionId, prompt, responseResultType, opts);
327
+ query = this.#claude.forkSession(this.#mainSessionId, formatted, responseResultType, opts);
328
328
  } else if (this.#mainSessionId) {
329
- query = this.#claude.resumeSession(this.#mainSessionId, prompt, responseResultType, opts);
329
+ query = this.#claude.resumeSession(this.#mainSessionId, formatted, responseResultType, opts);
330
330
  } else {
331
- query = this.#claude.newSession(prompt, responseResultType, opts);
331
+ query = this.#claude.newSession(formatted, responseResultType, opts);
332
332
  }
333
333
 
334
334
  const sid = query.sessionId;
335
- this.#runningSessions.set(sid, { name, prompt, model, query, lastMessageAt: new Date() });
335
+ this.#runningSessions.set(sid, { name, prompt: displayPrompt, model, query, lastMessageAt: new Date() });
336
336
 
337
337
  if (sid !== this.#mainSessionId) {
338
338
  log.info({ oldSessionId: this.#mainSessionId, newSessionId: sid }, "Session updated");