@ouro.bot/cli 0.1.0-alpha.40 → 0.1.0-alpha.41

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/changelog.json CHANGED
@@ -1,6 +1,15 @@
1
1
  {
2
2
  "_note": "This changelog is maintained as part of the PR/version-bump workflow. Agent-curated, not auto-generated. Agents read this file directly via read_file to understand what changed between versions.",
3
3
  "versions": [
4
+ {
5
+ "version": "0.1.0-alpha.41",
6
+ "changes": [
7
+ "JSONL readers (memory facts, inter-agent inbox) now skip corrupt lines instead of crashing — partial writes from crashes no longer lose all data.",
8
+ "Inter-agent message router now parses before clearing the inbox file, and preserves unparsed lines so corrupt messages are not silently lost.",
9
+ "Inner-dialog checkpoint derivation no longer crashes on all-whitespace assistant content — returns fallback checkpoint instead.",
10
+ "Update checker interval now catches and logs errors from the onUpdate callback instead of silently swallowing them."
11
+ ]
12
+ },
4
13
  {
5
14
  "version": "0.1.0-alpha.40",
6
15
  "changes": [
@@ -77,12 +77,21 @@ class FileMessageRouter {
77
77
  if (!fs.existsSync(inboxPath))
78
78
  return [];
79
79
  const raw = fs.readFileSync(inboxPath, "utf-8");
80
- fs.writeFileSync(inboxPath, "", "utf-8");
81
- const messages = raw
82
- .split("\n")
83
- .map((line) => line.trim())
84
- .filter((line) => line.length > 0)
85
- .map((line) => JSON.parse(line));
80
+ const messages = [];
81
+ const unparsed = [];
82
+ for (const line of raw.split("\n")) {
83
+ const trimmed = line.trim();
84
+ if (!trimmed)
85
+ continue;
86
+ try {
87
+ messages.push(JSON.parse(trimmed));
88
+ }
89
+ catch {
90
+ unparsed.push(trimmed);
91
+ }
92
+ }
93
+ // Only clear inbox after parsing; preserve lines that failed to parse.
94
+ fs.writeFileSync(inboxPath, unparsed.length > 0 ? unparsed.map((l) => `${l}\n`).join("") : "", "utf-8");
86
95
  (0, runtime_1.emitNervesEvent)({
87
96
  component: "daemon",
88
97
  event: "daemon.message_polled",
@@ -86,7 +86,15 @@ function startUpdateChecker(options) {
86
86
  if (result.available && options.onUpdate) {
87
87
  await options.onUpdate(result);
88
88
  }
89
- })();
89
+ })().catch((err) => {
90
+ (0, runtime_1.emitNervesEvent)({
91
+ component: "daemon",
92
+ event: "daemon.update_checker_error",
93
+ level: "warn",
94
+ message: "update checker tick failed",
95
+ meta: { reason: err instanceof Error ? err.message : /* v8 ignore next -- defensive: non-Error catch branch @preserve */ String(err) },
96
+ });
97
+ });
90
98
  }, intervalMs);
91
99
  }
92
100
  function stopUpdateChecker() {
@@ -120,9 +120,16 @@ function readExistingFacts(factsPath) {
120
120
  const raw = fs.readFileSync(factsPath, "utf8").trim();
121
121
  if (!raw)
122
122
  return [];
123
- return raw
124
- .split("\n")
125
- .map((line) => JSON.parse(line));
123
+ const facts = [];
124
+ for (const line of raw.split("\n")) {
125
+ try {
126
+ facts.push(JSON.parse(line));
127
+ }
128
+ catch {
129
+ // Skip corrupt lines (e.g. partial write from a crash).
130
+ }
131
+ }
132
+ return facts;
126
133
  }
127
134
  function readEntityIndex(entitiesPath) {
128
135
  if (!fs.existsSync(entitiesPath))
@@ -135,7 +135,10 @@ function deriveResumeCheckpoint(messages) {
135
135
  const firstLine = assistantText
136
136
  .split("\n")
137
137
  .map((line) => line.trim())
138
- .filter((line) => line.length > 0)[0];
138
+ .find((line) => line.length > 0);
139
+ /* v8 ignore next -- unreachable: contentToText().trim() guarantees a non-empty line @preserve */
140
+ if (!firstLine)
141
+ return "no prior checkpoint recorded";
139
142
  if (firstLine.length <= 220)
140
143
  return firstLine;
141
144
  return `${firstLine.slice(0, 217)}...`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ouro.bot/cli",
3
- "version": "0.1.0-alpha.40",
3
+ "version": "0.1.0-alpha.41",
4
4
  "main": "dist/heart/daemon/ouro-entry.js",
5
5
  "bin": {
6
6
  "cli": "dist/heart/daemon/ouro-bot-entry.js",