chainlesschain 0.45.3 → 0.45.4

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": "chainlesschain",
3
- "version": "0.45.3",
3
+ "version": "0.45.4",
4
4
  "description": "CLI for ChainlessChain - install, configure, and manage your personal AI management system",
5
5
  "type": "module",
6
6
  "bin": {
@@ -15,6 +15,7 @@ import { WSSessionManager } from "../lib/ws-session-manager.js";
15
15
  import { createWebUIServer } from "../lib/web-ui-server.js";
16
16
  import { bootstrap } from "../runtime/bootstrap.js";
17
17
  import { findProjectRoot, loadProjectConfig } from "../lib/project-detector.js";
18
+ import { loadConfig } from "../lib/config-manager.js";
18
19
 
19
20
  /**
20
21
  * Open a URL in the system default browser (cross-platform).
@@ -82,9 +83,11 @@ export function registerUiCommand(program) {
82
83
  }
83
84
 
84
85
  // ── Start WebSocket server ────────────────────────────────────────────
86
+ const appConfig = loadConfig();
85
87
  const sessionManager = new WSSessionManager({
86
88
  db,
87
89
  defaultProjectRoot: projectRoot || process.cwd(),
90
+ config: appConfig,
88
91
  });
89
92
 
90
93
  const wsServer = new ChainlessChainWSServer({
@@ -460,7 +460,7 @@ function buildHtml({
460
460
  <div id="conn-dot"></div>
461
461
  <span id="conn-label">未连接</span>
462
462
  </div>
463
- <span id="version-label">v5.0.2.4</span>
463
+ <span id="version-label">v5.0.2.5</span>
464
464
  </div>
465
465
  </nav>
466
466
 
@@ -523,6 +523,7 @@ function buildHtml({
523
523
  let selectedSessionType = 'agent';
524
524
  let pendingQuestionResolve = null;
525
525
  let _msgId = 0;
526
+ let _pendingMsgs = []; // buffered while session pending
526
527
  const sessions = new Map(); // id → { id, title, type, createdAt }
527
528
 
528
529
  // ── DOM refs ─────────────────────────────────────────────────────────────
@@ -791,6 +792,11 @@ function buildHtml({
791
792
  }
792
793
  renderSessionList();
793
794
  ws.onmessage = origHandler;
795
+ // Flush buffered messages sent while session was pending
796
+ for (const pending of _pendingMsgs) {
797
+ send({ type: 'session-message', sessionId: realId, content: pending });
798
+ }
799
+ _pendingMsgs = [];
794
800
  return;
795
801
  }
796
802
  // Pass through all other messages
@@ -984,6 +990,13 @@ function buildHtml({
984
990
  showMessagesArea();
985
991
  showTyping();
986
992
 
993
+ // If session is still pending (not yet confirmed by server), buffer
994
+ if (currentSessionId && currentSessionId.startsWith('pending-')) {
995
+ _pendingMsgs.push(text);
996
+ setTimeout(() => { btnSend.disabled = false; }, 500);
997
+ return;
998
+ }
999
+
987
1000
  send({
988
1001
  type: 'session-message',
989
1002
  sessionId: currentSessionId,
@@ -84,10 +84,15 @@ export class WSSessionManager {
84
84
  const sessionId = this._generateId();
85
85
  const type = options.type || "agent";
86
86
  const projectRoot = options.projectRoot || this.defaultProjectRoot;
87
- const provider = options.provider || "ollama";
87
+ const cfgLlm = this.config?.llm || {};
88
+ const provider = options.provider || cfgLlm.provider || "ollama";
88
89
  const model =
89
- options.model || (provider === "ollama" ? "qwen2.5:7b" : null);
90
- const baseUrl = options.baseUrl || "http://localhost:11434";
90
+ options.model ||
91
+ cfgLlm.model ||
92
+ (provider === "ollama" ? "qwen2.5:7b" : null);
93
+ const baseUrl =
94
+ options.baseUrl || cfgLlm.baseUrl || "http://localhost:11434";
95
+ const apiKey = options.apiKey || cfgLlm.apiKey || null;
91
96
 
92
97
  // Project context (rules.md, persona) is now loaded by buildSystemPrompt()
93
98
 
@@ -144,7 +149,7 @@ export class WSSessionManager {
144
149
  messages,
145
150
  provider,
146
151
  model,
147
- apiKey: options.apiKey || null,
152
+ apiKey,
148
153
  baseUrl,
149
154
  projectRoot,
150
155
  rulesContent: null,