@love-moon/conductor-cli 0.2.26 → 0.2.27

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.
@@ -101,7 +101,7 @@ async function runFallbackDiagnosis(baseUrl, token, taskId, timeoutMs) {
101
101
  }
102
102
 
103
103
  const task = taskResp.body || {};
104
- const messages = Array.isArray(msgResp.body) ? msgResp.body : [];
104
+ const messages = normalizeMessageHistoryPayload(msgResp.body);
105
105
  const agents = Array.isArray(agentsResp.body) ? agentsResp.body : [];
106
106
 
107
107
  const latestUser = messages
@@ -159,6 +159,16 @@ async function runFallbackDiagnosis(baseUrl, token, taskId, timeoutMs) {
159
159
  };
160
160
  }
161
161
 
162
+ function normalizeMessageHistoryPayload(payload) {
163
+ if (Array.isArray(payload)) {
164
+ return payload;
165
+ }
166
+ if (payload && typeof payload === "object" && Array.isArray(payload.messages)) {
167
+ return payload.messages;
168
+ }
169
+ return [];
170
+ }
171
+
162
172
  function classifyFallback(input) {
163
173
  if (input.taskStatus === "completed" || input.taskStatus === "killed") {
164
174
  return {
@@ -1650,6 +1650,16 @@ export class BridgeRunner {
1650
1650
  return role === "user" || role === "action";
1651
1651
  }
1652
1652
 
1653
+ normalizeMessageHistoryPayload(payload) {
1654
+ if (Array.isArray(payload)) {
1655
+ return payload;
1656
+ }
1657
+ if (payload && typeof payload === "object" && Array.isArray(payload.messages)) {
1658
+ return payload.messages;
1659
+ }
1660
+ return [];
1661
+ }
1662
+
1653
1663
  async backfillPendingUserMessages() {
1654
1664
  const backendUrl = process.env.CONDUCTOR_BACKEND_URL;
1655
1665
  const token = process.env.CONDUCTOR_AGENT_TOKEN;
@@ -1673,7 +1683,7 @@ export class BridgeRunner {
1673
1683
  this.copilotLog(`backfill request failed status=${response.status}`);
1674
1684
  return;
1675
1685
  }
1676
- const history = await response.json();
1686
+ const history = this.normalizeMessageHistoryPayload(await response.json());
1677
1687
  if (!Array.isArray(history) || history.length === 0) {
1678
1688
  this.copilotLog("backfill: no history messages");
1679
1689
  return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@love-moon/conductor-cli",
3
- "version": "0.2.26",
4
- "gitCommitId": "fc0cb59",
3
+ "version": "0.2.27",
4
+ "gitCommitId": "76b37c9",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "conductor": "bin/conductor.js"
@@ -17,8 +17,8 @@
17
17
  "test": "node --test test/*.test.js"
18
18
  },
19
19
  "dependencies": {
20
- "@love-moon/ai-sdk": "0.2.26",
21
- "@love-moon/conductor-sdk": "0.2.26",
20
+ "@love-moon/ai-sdk": "0.2.27",
21
+ "@love-moon/conductor-sdk": "0.2.27",
22
22
  "dotenv": "^16.4.5",
23
23
  "enquirer": "^2.4.1",
24
24
  "js-yaml": "^4.1.1",