comisai 1.0.30 → 1.0.32

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 (28) hide show
  1. package/node_modules/@comis/agent/package.json +1 -1
  2. package/node_modules/@comis/channels/package.json +1 -1
  3. package/node_modules/@comis/cli/dist/cli.js +2 -0
  4. package/node_modules/@comis/cli/dist/client/provider-list.d.ts +40 -0
  5. package/node_modules/@comis/cli/dist/client/provider-list.js +84 -0
  6. package/node_modules/@comis/cli/dist/commands/providers.d.ts +25 -0
  7. package/node_modules/@comis/cli/dist/commands/providers.js +122 -0
  8. package/node_modules/@comis/cli/dist/wizard/index.d.ts +2 -2
  9. package/node_modules/@comis/cli/dist/wizard/index.js +1 -1
  10. package/node_modules/@comis/cli/dist/wizard/non-interactive.js +29 -28
  11. package/node_modules/@comis/cli/dist/wizard/steps/03-provider.d.ts +11 -5
  12. package/node_modules/@comis/cli/dist/wizard/steps/03-provider.js +75 -13
  13. package/node_modules/@comis/cli/dist/wizard/steps/04-credentials.js +70 -12
  14. package/node_modules/@comis/cli/dist/wizard/steps/05-agent.js +6 -20
  15. package/node_modules/@comis/cli/dist/wizard/types.d.ts +0 -14
  16. package/node_modules/@comis/cli/dist/wizard/types.js +0 -24
  17. package/node_modules/@comis/cli/package.json +1 -1
  18. package/node_modules/@comis/core/package.json +1 -1
  19. package/node_modules/@comis/daemon/package.json +1 -1
  20. package/node_modules/@comis/gateway/package.json +1 -1
  21. package/node_modules/@comis/infra/package.json +1 -1
  22. package/node_modules/@comis/memory/package.json +1 -1
  23. package/node_modules/@comis/scheduler/package.json +1 -1
  24. package/node_modules/@comis/shared/package.json +1 -1
  25. package/node_modules/@comis/skills/package.json +1 -1
  26. package/node_modules/@comis/web/package.json +1 -1
  27. package/npm-shrinkwrap.json +5204 -1013
  28. package/package.json +13 -13
@@ -16,6 +16,7 @@
16
16
  * @module
17
17
  */
18
18
  import { updateState, sectionSeparator, info, validateApiKey, getKeyPrefix, } from "../index.js";
19
+ import { getModels } from "@mariozechner/pi-ai";
19
20
  // ---------- Provider Help URLs ----------
20
21
  const PROVIDER_HELP_URLS = {
21
22
  anthropic: "https://console.anthropic.com/settings/keys",
@@ -62,18 +63,75 @@ const AUTH_METHOD_PROVIDERS = {
62
63
  },
63
64
  };
64
65
  // ---------- Provider Validation Endpoints ----------
65
- const PROVIDER_VALIDATION = {
66
- anthropic: { baseUrl: "https://api.anthropic.com", path: "/v1/models" },
67
- openai: { baseUrl: "https://api.openai.com", path: "/v1/models" },
68
- google: { baseUrl: "https://generativelanguage.googleapis.com", path: "/v1/models" },
69
- groq: { baseUrl: "https://api.groq.com", path: "/openai/v1/models" },
70
- mistral: { baseUrl: "https://api.mistral.ai", path: "/v1/models" },
71
- deepseek: { baseUrl: "https://api.deepseek.com", path: "/v1/models" },
72
- xai: { baseUrl: "https://api.x.ai", path: "/v1/models" },
73
- together: { baseUrl: "https://api.together.xyz", path: "/v1/models" },
74
- cerebras: { baseUrl: "https://api.cerebras.ai", path: "/v1/models" },
75
- openrouter: { baseUrl: "https://openrouter.ai", path: "/api/v1/models" },
66
+ /**
67
+ * Path suffixes per provider, RELATIVE to the pi-ai catalog baseUrl.
68
+ *
69
+ * Pi-ai's catalog baseUrl shape is NOT uniform across providers:
70
+ * - HOST-ONLY for anthropic ("https://api.anthropic.com"), mistral, deepseek
71
+ * -> path here must include the version prefix ("/v1/models").
72
+ * - PREFIXED with the version segment for openai ("https://api.openai.com/v1"),
73
+ * google ("/v1beta"), groq ("/openai/v1"), xai ("/v1"), cerebras ("/v1"),
74
+ * openrouter ("/api/v1") -> path here must NOT repeat the version segment;
75
+ * append "/models" only.
76
+ *
77
+ * Composing entry.baseUrl + entry.path therefore produces the canonical /models
78
+ * endpoint for each provider (e.g., https://api.openai.com/v1/models,
79
+ * https://generativelanguage.googleapis.com/v1beta/models,
80
+ * https://api.groq.com/openai/v1/models).
81
+ *
82
+ * Follow-up to 260501-kqq Sub-Fix C: that migration replaced the static
83
+ * PROVIDER_VALIDATION map (which had host-only baseUrls + correct /v1/models
84
+ * suffixes) with the catalog-driven `getValidationEndpoint` helper, but the
85
+ * path-table values were copied verbatim -- producing double-prefixed URLs
86
+ * (e.g., https://api.openai.com/v1/v1/models -> 404) for the 6 providers
87
+ * whose catalog baseUrl includes the version segment. 260501-mvw corrects
88
+ * the table; the helper itself is unchanged.
89
+ *
90
+ * Drift risk: if pi-ai upgrades a provider's baseUrl AND its path convention
91
+ * changes, this table must be updated. Acceptable trade-off -- explicit
92
+ * beats clever (auto-detection of duplicated path segments could mask
93
+ * legitimate future shape changes).
94
+ *
95
+ * Excluded: `together` and `ollama` are NOT in pi-ai 0.71.0's catalog
96
+ * (`getModels(p)[0]?.baseUrl` returns undefined for both). The line-130
97
+ * fallback (`if (!entry) return { valid: true };`) handles them by
98
+ * skipping live validation entirely. For `together` this is a deliberate
99
+ * behavior change vs the pre-260501-kqq state -- live validation against
100
+ * api.together.xyz is now skipped. Users can still target Together via
101
+ * the synthetic `custom` endpoint route.
102
+ */
103
+ const PROVIDER_VALIDATION_PATHS = {
104
+ // Catalog baseUrl is HOST-ONLY for these providers -> path needs the /v1 prefix.
105
+ anthropic: "/v1/models",
106
+ mistral: "/v1/models",
107
+ deepseek: "/v1/models",
108
+ // Catalog baseUrl ALREADY INCLUDES the version prefix for these providers
109
+ // (e.g., openai's baseUrl is "https://api.openai.com/v1", openrouter's is
110
+ // "https://openrouter.ai/api/v1") -- append /models only.
111
+ openai: "/models",
112
+ google: "/models",
113
+ groq: "/models",
114
+ xai: "/models",
115
+ cerebras: "/models",
116
+ openrouter: "/models",
76
117
  };
118
+ /**
119
+ * Resolve the validation endpoint for a provider by reading the catalog
120
+ * baseUrl from pi-ai (260501-gyy precedent: builtin-provider-guard.ts:45)
121
+ * and combining it with a known path from PROVIDER_VALIDATION_PATHS.
122
+ *
123
+ * Returns `undefined` for providers not in the catalog (or providers
124
+ * with no models, e.g., ollama with no remote endpoint) -- callers
125
+ * skip live validation in that case.
126
+ */
127
+ function getValidationEndpoint(provider) {
128
+ const baseUrl = getModels(provider)[0]?.baseUrl;
129
+ if (!baseUrl)
130
+ return undefined;
131
+ // eslint-disable-next-line security/detect-object-injection -- read of static const map indexed by validated provider string
132
+ const path = PROVIDER_VALIDATION_PATHS[provider] ?? "/v1/models";
133
+ return { baseUrl, path };
134
+ }
77
135
  // ---------- Live Validation ----------
78
136
  /**
79
137
  * Validate an API key against the provider's /models endpoint.
@@ -91,7 +149,7 @@ async function validateKeyLive(provider, apiKey, authMethod) {
91
149
  if (authMethod === "oauth") {
92
150
  return { valid: true };
93
151
  }
94
- const entry = PROVIDER_VALIDATION[provider];
152
+ const entry = getValidationEndpoint(provider);
95
153
  if (!entry) {
96
154
  return { valid: true };
97
155
  }
@@ -11,20 +11,6 @@
11
11
  */
12
12
  import { updateState, sectionSeparator, validateAgentName, } from "../index.js";
13
13
  import { createModelCatalog } from "@comis/agent";
14
- // ---------- Recommended Models Per Provider ----------
15
- const RECOMMENDED_MODELS = {
16
- anthropic: "claude-sonnet-4-5-20250929",
17
- openai: "gpt-4o",
18
- google: "gemini-2.0-flash",
19
- groq: "llama-3.3-70b-versatile",
20
- mistral: "mistral-large-latest",
21
- deepseek: "deepseek-chat",
22
- xai: "grok-2",
23
- together: "meta-llama/Meta-Llama-3.1-70B-Instruct-Turbo",
24
- cerebras: "llama-3.3-70b",
25
- openrouter: "anthropic/claude-sonnet-4-5-20250929",
26
- ollama: "llama3",
27
- };
28
14
  // ---------- Helpers ----------
29
15
  function formatModelHint(m) {
30
16
  const parts = [];
@@ -67,8 +53,6 @@ export const agentStep = {
67
53
  catch {
68
54
  // Fallback: empty catalog, will use recommended default only
69
55
  }
70
- const providerId = state.provider?.id ?? "";
71
- const recommended = RECOMMENDED_MODELS[providerId];
72
56
  // 4. QuickStart flow -- use "default" so the daemon picks the model at runtime
73
57
  if (state.flow === "quickstart") {
74
58
  prompter.log.info("Model: default");
@@ -87,11 +71,13 @@ export const agentStep = {
87
71
  label: "Custom model ID...",
88
72
  hint: "Enter a model ID manually",
89
73
  });
74
+ // Initial value: state.model takes precedence; otherwise the
75
+ // first catalog entry. No hardcoded recommendation lookup --
76
+ // pi-ai's catalog ordering is the source of truth.
90
77
  const chosen = await prompter.select({
91
78
  message: "Select a model",
92
79
  options,
93
- initialValue: state.model
94
- ?? (recommended && catalogModels.some((m) => m.modelId === recommended) ? recommended : undefined),
80
+ initialValue: state.model ?? catalogModels[0]?.modelId,
95
81
  });
96
82
  if (chosen === "__custom__") {
97
83
  selectedModel = await prompter.text({
@@ -107,8 +93,8 @@ export const agentStep = {
107
93
  // Empty catalog -- go directly to custom text input
108
94
  selectedModel = await prompter.text({
109
95
  message: "Model ID",
110
- placeholder: recommended ?? "model-name",
111
- defaultValue: state.model ?? recommended,
96
+ placeholder: state.model ?? "model-name",
97
+ defaultValue: state.model,
112
98
  });
113
99
  }
114
100
  return updateState(state, { agentName, model: selectedModel });
@@ -134,20 +134,6 @@ export type WizardResult = {
134
134
  envPath?: string;
135
135
  error?: WizardError;
136
136
  };
137
- /** Supported provider entry for selection prompts. */
138
- export type SupportedProvider = {
139
- id: string;
140
- label: string;
141
- hint?: string;
142
- category: "recommended" | "other" | "local" | "custom";
143
- };
144
- /**
145
- * All supported LLM providers, grouped by category.
146
- *
147
- * Categories: recommended (top picks), other (cloud APIs),
148
- * local (self-hosted), custom (user-defined endpoints).
149
- */
150
- export declare const SUPPORTED_PROVIDERS: readonly SupportedProvider[];
151
137
  /** Supported channel entry for selection prompts. */
152
138
  export type SupportedChannel = {
153
139
  type: ChannelConfig["type"];
@@ -9,30 +9,6 @@
9
9
  */
10
10
  /** Starting state for a new wizard run. */
11
11
  export const INITIAL_STATE = { completedSteps: [] };
12
- /**
13
- * All supported LLM providers, grouped by category.
14
- *
15
- * Categories: recommended (top picks), other (cloud APIs),
16
- * local (self-hosted), custom (user-defined endpoints).
17
- */
18
- export const SUPPORTED_PROVIDERS = [
19
- // Recommended
20
- { id: "anthropic", label: "Anthropic (Claude)", hint: "Recommended for agents", category: "recommended" },
21
- { id: "openai", label: "OpenAI (GPT)", hint: "GPT-4o, o1, o3 models", category: "recommended" },
22
- // Other Providers
23
- { id: "google", label: "Google (Gemini)", hint: "Gemini models", category: "other" },
24
- { id: "groq", label: "Groq", hint: "Fast inference (Llama, Mixtral)", category: "other" },
25
- { id: "mistral", label: "Mistral", hint: "Mistral models", category: "other" },
26
- { id: "deepseek", label: "DeepSeek", hint: "DeepSeek models", category: "other" },
27
- { id: "xai", label: "xAI (Grok)", hint: "Grok models", category: "other" },
28
- { id: "together", label: "Together AI", hint: "Open-source model hosting", category: "other" },
29
- { id: "cerebras", label: "Cerebras", hint: "Fast inference", category: "other" },
30
- { id: "openrouter", label: "OpenRouter", hint: "Multi-provider routing", category: "other" },
31
- // Local
32
- { id: "ollama", label: "Ollama (local)", hint: "No API key needed", category: "local" },
33
- // Custom
34
- { id: "custom", label: "Custom endpoint", hint: "OpenAI-compatible API", category: "custom" },
35
- ];
36
12
  /** All supported chat channels with credential guidance. */
37
13
  export const SUPPORTED_CHANNELS = [
38
14
  { type: "telegram", label: "Telegram", credentialHint: "Bot token from @BotFather" },
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/cli",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Command-line interface for the Comis AI agent platform",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/core",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Core domain types, ports, event bus, security, and config for Comis",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/daemon",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Background daemon and orchestrator for the Comis platform",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/gateway",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "HTTP, JSON-RPC, and WebSocket gateway for Comis",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/infra",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Structured logging infrastructure for Comis",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/memory",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "SQLite memory, embeddings, and RAG storage for Comis agents",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/scheduler",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Task scheduling and cron management for Comis",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/shared",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Shared types and utilities for the Comis platform",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@comis/skills",
3
3
  "private": true,
4
- "version": "1.0.30",
4
+ "version": "1.0.32",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",
7
7
  "description": "Skill system, MCP integration, and tool sandbox for Comis agents",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comis/web",
3
- "version": "1.0.30",
3
+ "version": "1.0.32",
4
4
  "description": "Web dashboard SPA for Comis agent management",
5
5
  "author": "Moshe Anconina",
6
6
  "license": "Apache-2.0",