@adhdev/daemon-core 0.9.76-rc.21 → 0.9.76-rc.22

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.
@@ -5,7 +5,7 @@
5
5
  * transports, and web-core. Git state is daemon-owned product truth; do not
6
6
  * infer these values from agent transcripts in frontend code.
7
7
  */
8
- export type GitFailureReason = 'not_git_repo' | 'git_not_installed' | 'timeout' | 'path_outside_repo' | 'dirty_index_required' | 'conflict' | 'invalid_args' | 'git_command_failed';
8
+ export type GitFailureReason = 'not_git_repo' | 'git_not_installed' | 'timeout' | 'path_outside_repo' | 'dirty_index_required' | 'conflict' | 'invalid_args' | 'nothing_to_commit' | 'git_command_failed';
9
9
  export interface GitRepoIdentity {
10
10
  workspace: string;
11
11
  repoRoot: string | null;
package/dist/index.js CHANGED
@@ -4890,6 +4890,7 @@ var FAILURE_REASONS = /* @__PURE__ */ new Set([
4890
4890
  "dirty_index_required",
4891
4891
  "conflict",
4892
4892
  "invalid_args",
4893
+ "nothing_to_commit",
4893
4894
  "git_command_failed"
4894
4895
  ]);
4895
4896
  function failure(reason, error) {
@@ -5134,7 +5135,10 @@ async function gitCheckpoint(workspace, message, includeUntracked) {
5134
5135
  } catch (err) {
5135
5136
  const output = (err?.stdout || "") + (err?.stderr || "");
5136
5137
  if (/nothing to commit/i.test(output)) {
5137
- throw new GitCommandError("git_command_failed", "Nothing to commit");
5138
+ throw new GitCommandError("nothing_to_commit", "Nothing to commit \u2014 working tree is clean.", {
5139
+ stdout: err?.stdout,
5140
+ stderr: err?.stderr
5141
+ });
5138
5142
  }
5139
5143
  throw err;
5140
5144
  }
@@ -15665,10 +15669,26 @@ ${effect.notification.body || ""}`.trim();
15665
15669
  }
15666
15670
  mergeConversationMessages(parsedMessages) {
15667
15671
  if (this.runtimeMessages.length === 0) return normalizeChatMessages(parsedMessages);
15668
- return normalizeChatMessages([...parsedMessages, ...this.runtimeMessages.map((entry) => entry.message)].map((message, index) => ({ message, index })).sort((a, b) => {
15669
- const aTime = a.message.receivedAt || a.message.timestamp || 0;
15670
- const bTime = b.message.receivedAt || b.message.timestamp || 0;
15671
- if (aTime !== bTime) return aTime - bTime;
15672
+ const parsedEntries = parsedMessages.map((message, index) => ({
15673
+ message,
15674
+ index,
15675
+ source: "parsed"
15676
+ }));
15677
+ const runtimeEntries = this.runtimeMessages.map((entry, index) => ({
15678
+ message: entry.message,
15679
+ index: parsedMessages.length + index,
15680
+ source: "runtime"
15681
+ }));
15682
+ const getTime = (message) => {
15683
+ const value = typeof message.receivedAt === "number" ? message.receivedAt : typeof message.timestamp === "number" ? message.timestamp : 0;
15684
+ return Number.isFinite(value) && value > 0 ? value : 0;
15685
+ };
15686
+ return normalizeChatMessages([...parsedEntries, ...runtimeEntries].sort((a, b) => {
15687
+ const aTime = getTime(a.message);
15688
+ const bTime = getTime(b.message);
15689
+ if (aTime && bTime && aTime !== bTime) return aTime - bTime;
15690
+ if (aTime && !bTime && a.source === "runtime" && b.source === "parsed") return -1;
15691
+ if (!aTime && bTime && a.source === "parsed" && b.source === "runtime") return 1;
15672
15692
  return a.index - b.index;
15673
15693
  }).map((entry) => entry.message));
15674
15694
  }