replicas-engine 0.1.24 → 0.1.25

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.
Files changed (2) hide show
  1. package/dist/src/index.js +43 -4
  2. package/package.json +1 -1
package/dist/src/index.js CHANGED
@@ -91,6 +91,15 @@ var MonolithService = class {
91
91
  var monolithService = new MonolithService();
92
92
 
93
93
  // src/services/linear-event-converter.ts
94
+ function linearThoughtToResponse(thought) {
95
+ return {
96
+ linearSessionId: thought.linearSessionId,
97
+ content: {
98
+ type: "response",
99
+ body: thought.content.body
100
+ }
101
+ };
102
+ }
94
103
  function summarizeInput(input) {
95
104
  if (!input) return "";
96
105
  if (typeof input === "string") return input;
@@ -1092,15 +1101,30 @@ var CodexManager = class {
1092
1101
  input = message;
1093
1102
  }
1094
1103
  const { events } = await this.currentThread.runStreamed(input);
1104
+ let latestThoughtEvent = null;
1095
1105
  for await (const event of events) {
1096
1106
  if (linearSessionId) {
1097
1107
  const linearEvent = convertCodexEvent(event, linearSessionId);
1098
1108
  if (linearEvent) {
1099
- monolithService.sendEvent({ type: "agent_update", payload: linearEvent }).catch(() => {
1100
- });
1109
+ if (latestThoughtEvent) {
1110
+ monolithService.sendEvent({ type: "agent_update", payload: latestThoughtEvent }).catch(() => {
1111
+ });
1112
+ }
1113
+ if (linearEvent.content.type === "thought") {
1114
+ latestThoughtEvent = linearEvent;
1115
+ } else {
1116
+ latestThoughtEvent = null;
1117
+ monolithService.sendEvent({ type: "agent_update", payload: linearEvent }).catch(() => {
1118
+ });
1119
+ }
1101
1120
  }
1102
1121
  }
1103
1122
  }
1123
+ if (linearSessionId && latestThoughtEvent) {
1124
+ const responseEvent = linearThoughtToResponse(latestThoughtEvent);
1125
+ monolithService.sendEvent({ type: "agent_update", payload: responseEvent }).catch(() => {
1126
+ });
1127
+ }
1104
1128
  } finally {
1105
1129
  if (linearSessionId) {
1106
1130
  const status = await getGitStatus(this.workingDirectory);
@@ -1494,16 +1518,31 @@ var ClaudeManager = class {
1494
1518
  model: model || "opus"
1495
1519
  }
1496
1520
  });
1521
+ let latestThoughtEvent = null;
1497
1522
  for await (const msg of response) {
1498
1523
  await this.handleMessage(msg);
1499
1524
  if (linearSessionId) {
1500
1525
  const linearEvent = convertClaudeEvent(msg, linearSessionId);
1501
1526
  if (linearEvent) {
1502
- monolithService.sendEvent({ type: "agent_update", payload: linearEvent }).catch(() => {
1503
- });
1527
+ if (latestThoughtEvent) {
1528
+ monolithService.sendEvent({ type: "agent_update", payload: latestThoughtEvent }).catch(() => {
1529
+ });
1530
+ }
1531
+ if (linearEvent.content.type === "thought") {
1532
+ latestThoughtEvent = linearEvent;
1533
+ } else {
1534
+ latestThoughtEvent = null;
1535
+ monolithService.sendEvent({ type: "agent_update", payload: linearEvent }).catch(() => {
1536
+ });
1537
+ }
1504
1538
  }
1505
1539
  }
1506
1540
  }
1541
+ if (linearSessionId && latestThoughtEvent) {
1542
+ const responseEvent = linearThoughtToResponse(latestThoughtEvent);
1543
+ monolithService.sendEvent({ type: "agent_update", payload: responseEvent }).catch(() => {
1544
+ });
1545
+ }
1507
1546
  } finally {
1508
1547
  if (linearSessionId) {
1509
1548
  const status = await getGitStatus(this.workingDirectory);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "replicas-engine",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "Lightweight API server for Replicas workspaces",
5
5
  "type": "module",
6
6
  "main": "dist/src/index.js",