chainlesschain 0.40.2 → 0.41.0

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/README.md CHANGED
@@ -142,7 +142,7 @@ chainlesschain note revert <id> <ver> # Revert to a version
142
142
  Start an interactive AI chat session with streaming output.
143
143
 
144
144
  ```bash
145
- chainlesschain chat # Default: Ollama qwen2:7b
145
+ chainlesschain chat # Default: Ollama qwen2.5:7b
146
146
  chainlesschain chat --model llama3 # Use different model
147
147
  chainlesschain chat --provider openai --api-key sk-...
148
148
  chainlesschain chat --agent # Agentic mode (can read/write files)
@@ -176,15 +176,17 @@ chainlesschain llm switch <name> # Switch active provider
176
176
 
177
177
  ### `chainlesschain agent` (alias: `a`)
178
178
 
179
- Start an agentic AI session — the AI can read/write files, run shell commands, search the codebase, and invoke 138 built-in skills.
179
+ Start an agentic AI session — the AI can read/write files, run shell commands, search the codebase, execute code (Python/Node.js/Bash with auto pip-install), and invoke 138 built-in skills.
180
180
 
181
181
  ```bash
182
- chainlesschain agent # Default: Ollama qwen2:7b
182
+ chainlesschain agent # Default: Ollama qwen2.5:7b
183
183
  chainlesschain a --model llama3 # Short alias
184
184
  chainlesschain agent --provider openai --api-key sk-...
185
185
  ```
186
186
 
187
- Built-in tools: `read_file`, `write_file`, `edit_file`, `run_shell`, `search_files`, `list_dir`, `run_skill`, `list_skills`
187
+ Built-in tools: `read_file`, `write_file`, `edit_file`, `run_shell`, `search_files`, `list_dir`, `run_skill`, `list_skills`, `run_code`
188
+
189
+ Agent slash commands: `/plan` (plan mode), `/plan interactive <request>` (LLM-driven planning with skill recommendations), `/model`, `/provider`, `/clear`, `/compact`, `/task`, `/session`, `/stats`, `/auto` (autonomous agent), `/cowork` (multi-agent collaboration)
188
190
 
189
191
  ### `chainlesschain skill <action>`
190
192
 
@@ -826,8 +828,11 @@ chainlesschain serve # Start WebSocket server
826
828
  chainlesschain serve --port 9000 # Custom port
827
829
  chainlesschain serve --token <secret> # Enable token auth
828
830
  chainlesschain serve --allow-remote --token <secret> # Allow remote + auth
831
+ chainlesschain serve --project /path/to/project # Default project root for sessions
829
832
  ```
830
833
 
834
+ **Session Protocol** (v0.41.0): WebSocket clients can create stateful agent/chat sessions via `session-create`, send messages via `session-message`, resume previous sessions via `session-resume`, and manage sessions via `session-list`/`session-close`. Supports `slash-command` for in-session commands and `session-answer` for interactive Q&A (SlotFiller/Planner).
835
+
831
836
  ---
832
837
 
833
838
  ## Global Options
@@ -854,7 +859,7 @@ Configuration is stored at `~/.chainlesschain/config.json`. The CLI creates and
854
859
  "provider": "ollama",
855
860
  "apiKey": null,
856
861
  "baseUrl": "http://localhost:11434",
857
- "model": "qwen2:7b"
862
+ "model": "qwen2.5:7b"
858
863
  },
859
864
  "enterprise": {
860
865
  "serverUrl": null,
@@ -876,7 +881,7 @@ Configuration is stored at `~/.chainlesschain/config.json`. The CLI creates and
876
881
 
877
882
  | Provider | Default Model | API Key Required |
878
883
  | ---------------------- | ----------------- | ---------------- |
879
- | Ollama (Local) | qwen2:7b | No |
884
+ | Ollama (Local) | qwen2.5:7b | No |
880
885
  | OpenAI | gpt-4o | Yes |
881
886
  | Anthropic | claude-sonnet-4-6 | Yes |
882
887
  | DashScope (Alibaba) | qwen-max | Yes |
@@ -903,7 +908,7 @@ Configuration is stored at `~/.chainlesschain/config.json`. The CLI creates and
903
908
  ```bash
904
909
  cd packages/cli
905
910
  npm install
906
- npm test # Run all tests (2063 tests across 99 files)
911
+ npm test # Run all tests (2503 tests across 113 files)
907
912
  npm run test:unit # Unit tests only
908
913
  npm run test:integration # Integration tests
909
914
  npm run test:e2e # End-to-end tests
@@ -911,15 +916,17 @@ npm run test:e2e # End-to-end tests
911
916
 
912
917
  ### Test Coverage
913
918
 
914
- | Category | Files | Tests | Status |
915
- | ------------------------ | ------ | -------- | --------------- |
916
- | Unit — lib modules | 56 | 1200+ | All passing |
917
- | Unit — commands | 15 | 350+ | All passing |
918
- | Unit — runtime | 1 | 6 | All passing |
919
- | Integration | 5 | 30+ | All passing |
920
- | E2E | 14 | 150+ | All passing |
921
- | Core packages (external) | — | 118 | All passing |
922
- | **CLI Total** | **99** | **2063** | **All passing** |
919
+ | Category | Files | Tests | Status |
920
+ | ------------------------ | ------- | -------- | --------------- |
921
+ | Unit — lib modules | 56 | 1200+ | All passing |
922
+ | Unit — commands | 15 | 350+ | All passing |
923
+ | Unit — runtime | 1 | 6 | All passing |
924
+ | Integration | 5 | 30+ | All passing |
925
+ | E2E | 14 | 150+ | All passing |
926
+ | Core packages (external) | — | 118 | All passing |
927
+ | Unit WS sessions | 9 | 156 | All passing |
928
+ | Integration — WS session | 1 | 12 | All passing |
929
+ | **CLI Total** | **113** | **2503** | **All passing** |
923
930
 
924
931
  ## License
925
932
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chainlesschain",
3
- "version": "0.40.2",
3
+ "version": "0.41.0",
4
4
  "description": "CLI for ChainlessChain - install, configure, and manage your personal AI management system",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,11 +1,13 @@
1
1
  /**
2
2
  * serve command — start a WebSocket server for remote CLI access
3
- * chainlesschain serve [--port] [--host] [--token] [--max-connections] [--timeout] [--allow-remote]
3
+ * chainlesschain serve [--port] [--host] [--token] [--max-connections] [--timeout] [--allow-remote] [--project]
4
4
  */
5
5
 
6
6
  import chalk from "chalk";
7
7
  import { logger } from "../lib/logger.js";
8
8
  import { ChainlessChainWSServer } from "../lib/ws-server.js";
9
+ import { WSSessionManager } from "../lib/ws-session-manager.js";
10
+ import { bootstrap } from "../runtime/bootstrap.js";
9
11
 
10
12
  export function registerServeCommand(program) {
11
13
  program
@@ -27,6 +29,7 @@ export function registerServeCommand(program) {
27
29
  "--allow-remote",
28
30
  "Allow non-localhost connections (requires --token)",
29
31
  )
32
+ .option("--project <path>", "Default project root for sessions")
30
33
  .action(async (opts) => {
31
34
  const port = parseInt(opts.port, 10);
32
35
  const maxConnections = parseInt(opts.maxConnections, 10);
@@ -47,12 +50,32 @@ export function registerServeCommand(program) {
47
50
  host = "0.0.0.0";
48
51
  }
49
52
 
53
+ // Bootstrap headless runtime for DB access
54
+ let db = null;
55
+ try {
56
+ const ctx = await bootstrap({ skipDb: false });
57
+ db = ctx.db?.getDb?.() || null;
58
+ } catch (_err) {
59
+ logger.log(
60
+ chalk.yellow(
61
+ " Warning: Database not available, sessions will be in-memory only",
62
+ ),
63
+ );
64
+ }
65
+
66
+ // Create session manager
67
+ const sessionManager = new WSSessionManager({
68
+ db,
69
+ defaultProjectRoot: opts.project || process.cwd(),
70
+ });
71
+
50
72
  const server = new ChainlessChainWSServer({
51
73
  port,
52
74
  host,
53
75
  token: opts.token || null,
54
76
  maxConnections,
55
77
  timeout,
78
+ sessionManager,
56
79
  });
57
80
 
58
81
  // Event logging
@@ -76,6 +99,14 @@ export function registerServeCommand(program) {
76
99
  logger.log(color(` < [${id}] exit ${exitCode}`));
77
100
  });
78
101
 
102
+ server.on("session:create", ({ sessionId, type }) => {
103
+ logger.log(chalk.green(` + Session created: ${sessionId} (${type})`));
104
+ });
105
+
106
+ server.on("session:close", ({ sessionId }) => {
107
+ logger.log(chalk.yellow(` - Session closed: ${sessionId}`));
108
+ });
109
+
79
110
  // Graceful shutdown
80
111
  const shutdown = async () => {
81
112
  logger.log("\n" + chalk.yellow("Shutting down WebSocket server..."));
@@ -96,6 +127,8 @@ export function registerServeCommand(program) {
96
127
  logger.log(
97
128
  ` Auth: ${opts.token ? chalk.green("enabled") : chalk.yellow("disabled")}`,
98
129
  );
130
+ logger.log(` Sessions: ${chalk.green("enabled")}`);
131
+ logger.log(` Project: ${opts.project || process.cwd()}`);
99
132
  logger.log(` Max conn: ${maxConnections}`);
100
133
  logger.log(` Timeout: ${timeout}ms`);
101
134
  logger.log("");