chainlesschain 0.37.12 → 0.40.1

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.
Files changed (48) hide show
  1. package/package.json +3 -2
  2. package/src/commands/agent.js +7 -1
  3. package/src/commands/ask.js +24 -9
  4. package/src/commands/chat.js +7 -1
  5. package/src/commands/cli-anything.js +266 -0
  6. package/src/commands/compliance.js +216 -0
  7. package/src/commands/dao.js +312 -0
  8. package/src/commands/dlp.js +278 -0
  9. package/src/commands/evomap.js +558 -0
  10. package/src/commands/hardening.js +230 -0
  11. package/src/commands/matrix.js +168 -0
  12. package/src/commands/nostr.js +185 -0
  13. package/src/commands/pqc.js +162 -0
  14. package/src/commands/scim.js +218 -0
  15. package/src/commands/serve.js +109 -0
  16. package/src/commands/siem.js +156 -0
  17. package/src/commands/social.js +480 -0
  18. package/src/commands/terraform.js +148 -0
  19. package/src/constants.js +1 -0
  20. package/src/index.js +60 -0
  21. package/src/lib/autonomous-agent.js +487 -0
  22. package/src/lib/cli-anything-bridge.js +379 -0
  23. package/src/lib/cli-context-engineering.js +472 -0
  24. package/src/lib/compliance-manager.js +290 -0
  25. package/src/lib/content-recommender.js +205 -0
  26. package/src/lib/dao-governance.js +296 -0
  27. package/src/lib/dlp-engine.js +304 -0
  28. package/src/lib/evomap-client.js +135 -0
  29. package/src/lib/evomap-federation.js +240 -0
  30. package/src/lib/evomap-governance.js +250 -0
  31. package/src/lib/evomap-manager.js +227 -0
  32. package/src/lib/git-integration.js +1 -1
  33. package/src/lib/hardening-manager.js +275 -0
  34. package/src/lib/llm-providers.js +14 -1
  35. package/src/lib/matrix-bridge.js +196 -0
  36. package/src/lib/nostr-bridge.js +195 -0
  37. package/src/lib/permanent-memory.js +370 -0
  38. package/src/lib/plan-mode.js +211 -0
  39. package/src/lib/pqc-manager.js +196 -0
  40. package/src/lib/scim-manager.js +212 -0
  41. package/src/lib/session-manager.js +38 -0
  42. package/src/lib/siem-exporter.js +137 -0
  43. package/src/lib/social-manager.js +283 -0
  44. package/src/lib/task-model-selector.js +232 -0
  45. package/src/lib/terraform-manager.js +201 -0
  46. package/src/lib/ws-server.js +474 -0
  47. package/src/repl/agent-repl.js +796 -41
  48. package/src/repl/chat-repl.js +14 -6
@@ -11,6 +11,7 @@
11
11
  import readline from "readline";
12
12
  import chalk from "chalk";
13
13
  import { logger } from "../lib/logger.js";
14
+ import { BUILT_IN_PROVIDERS } from "../lib/llm-providers.js";
14
15
 
15
16
  const SLASH_COMMANDS = {
16
17
  "/exit": "Exit the chat",
@@ -128,7 +129,7 @@ export async function startChatRepl(options = {}) {
128
129
  let model = options.model || "qwen2:7b";
129
130
  let provider = options.provider || "ollama";
130
131
  const baseUrl = options.baseUrl || "http://localhost:11434";
131
- const apiKey = options.apiKey || process.env.OPENAI_API_KEY;
132
+ const apiKey = options.apiKey || null;
132
133
 
133
134
  const messages = [];
134
135
 
@@ -236,14 +237,21 @@ export async function startChatRepl(options = {}) {
236
237
 
237
238
  if (provider === "ollama") {
238
239
  response = await streamOllama(messages, model, baseUrl, onToken);
239
- } else if (provider === "openai") {
240
+ } else {
241
+ // OpenAI-compatible providers (openai, volcengine, deepseek, dashscope, mistral, gemini, anthropic-proxy)
242
+ const providerDef = BUILT_IN_PROVIDERS[provider];
240
243
  const url =
241
244
  baseUrl !== "http://localhost:11434"
242
245
  ? baseUrl
243
- : "https://api.openai.com/v1";
244
- response = await streamOpenAI(messages, model, url, apiKey, onToken);
245
- } else {
246
- throw new Error(`Unsupported provider: ${provider}`);
246
+ : providerDef?.baseUrl || "https://api.openai.com/v1";
247
+ const key =
248
+ apiKey ||
249
+ (providerDef?.apiKeyEnv ? process.env[providerDef.apiKeyEnv] : null);
250
+ if (!key)
251
+ throw new Error(
252
+ `API key required for ${provider} (set ${providerDef?.apiKeyEnv || "API key"})`,
253
+ );
254
+ response = await streamOpenAI(messages, model, url, key, onToken);
247
255
  }
248
256
 
249
257
  process.stdout.write("\n\n");