skyloom 1.4.1 → 1.4.2

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": "skyloom",
3
- "version": "1.4.1",
3
+ "version": "1.4.2",
4
4
  "description": "天空织机 Skyloom — 6 weather-themed AI agents: Fog, Rain, Frost, Snow, Dew, Fair",
5
5
  "preferGlobal": true,
6
6
  "type": "commonjs",
package/src/core/agent.ts CHANGED
@@ -729,13 +729,14 @@ export class BaseAgent {
729
729
  try {
730
730
  if (onStatus) onStatus('thinking...');
731
731
  const response = await this.llmLoop({ onStatus });
732
- this.memory.addMessage('assistant', response.content, {
733
- toolCalls: response.toolCalls,
734
- reasoningContent: response.reasoningContent,
732
+ const content = response?.content || '(no response)';
733
+ this.memory.addMessage('assistant', content, {
734
+ toolCalls: response?.toolCalls || [],
735
+ reasoningContent: response?.reasoningContent,
735
736
  });
736
737
  await this.setState(AgentState.IDLE);
737
738
  this.maybeExtractFacts();
738
- return response.content;
739
+ return content;
739
740
  } catch (e) {
740
741
  await this.setState(AgentState.ERROR);
741
742
  this.popLastUserMessage();
@@ -69,9 +69,8 @@ export class Logger {
69
69
  return value;
70
70
  });
71
71
 
72
- // Output to stderr for logs, stdout for normal output
73
- const output = level >= LogLevel.WARN ? console.error : console.log;
74
- output(line);
72
+ // Write all logs to stderr to keep stdout clean for chat/TUI
73
+ process.stderr.write(line + "\n");
75
74
  }
76
75
 
77
76
  debug(msg: string, extra?: Record<string, unknown>) {
@@ -100,7 +99,7 @@ export class Logger {
100
99
  */
101
100
  const loggers = new Map<string, Logger>();
102
101
  let requestId: string | null = null;
103
- let defaultLogLevel = LogLevel.INFO;
102
+ let defaultLogLevel = LogLevel.WARN; // Only warnings+errors by default
104
103
 
105
104
  /**
106
105
  * Get or create a logger for a component
@@ -276,7 +276,9 @@ export class Memory {
276
276
  private dbRun(sql: string, params?: any[]): void {
277
277
  if (!this.db) return;
278
278
  try {
279
- this.db.run(sql, params);
279
+ // Sql.js rejects `undefined` in bind arrays; normalize to `null`
280
+ const safe = params ? params.map((v) => v === undefined ? null : v) : undefined;
281
+ this.db.run(sql, safe);
280
282
  } catch (err) {
281
283
  logger.warn('db_run_failed', { sql: sql.slice(0, 80), error: String(err) });
282
284
  }