@m6d/cortex-cli 0.8.1 → 0.9.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
@@ -44,8 +44,8 @@ hard error rather than a hang.
44
44
  | `--control-center` / `--no-control-center` | off | `controlCenter` |
45
45
  | `--yes` | | Accept the defaults instead of asking |
46
46
 
47
- Unselected features are still written to `cortex.config.ts`, commented out, alongside `fastModel`,
48
- `reranker`, and `context` — the generated config documents what else exists. Every credential and
47
+ Unselected features are still written to `cortex.config.ts`, commented out, alongside `reranker`
48
+ and `context` — the generated config documents what else exists. Every credential and
49
49
  URL is a placeholder in `.env`; none of them is prompted for.
50
50
 
51
51
  ## `cortex swagger sync` / `check`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex-cli",
3
- "version": "0.8.1",
3
+ "version": "0.9.0",
4
4
  "description": "Scaffold and operate Cortex servers",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -14,6 +14,7 @@ import {
14
14
  variableDeclarationSchema,
15
15
  } from "./grammar";
16
16
  import { publishedAuthSchema } from "./auth";
17
+ import { runtimeModelsSchema } from "./models";
17
18
  import { triggerDeclarationSchema } from "./triggers";
18
19
  import { datasetHostDeclarationSchema, datasetIdentifierSchema } from "./datasets";
19
20
 
@@ -216,6 +217,12 @@ export const runtimeAgentConfigSchema = z.object({
216
217
  suggestions: suggestionsSchema,
217
218
  /** Operational like `suggestions`. */
218
219
  greeting: greetingSchema,
220
+ /**
221
+ * The model picks of the agent's server and of the agent, with the
222
+ * providers they and the agent's triggers name. Operational like
223
+ * `greeting`: edited without republishing.
224
+ */
225
+ models: runtimeModelsSchema,
219
226
  /** The resolved agent's id; reports about it carry this so they attach to it whatever the slug or alias later means. */
220
227
  agentRef: agentRefSchema,
221
228
  catalogVersion: catalogVersionSchema,
@@ -7,6 +7,7 @@ export * from "./grammar";
7
7
  export * from "./auth";
8
8
  export * from "./api";
9
9
  export * from "./triggers";
10
+ export * from "./models";
10
11
  export * from "./datasets";
11
12
  export * from "./dataset-sql";
12
13
  export * from "./dataset-sql-guide";
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+
3
+ /**
4
+ * One level's pick of what a run talks to: a model a Control Center
5
+ * provider lists, the reasoning effort sent with it, both, or neither. An
6
+ * unset part inherits from the level above (trigger, then agent, then
7
+ * server, then the server's code config). An effort carries down only as
8
+ * far as the level that picked the model, and is sent only when that
9
+ * model's provider lists it.
10
+ */
11
+ export const modelChoiceSchema = z
12
+ .object({
13
+ provider: z.string().min(1).nullable(),
14
+ model: z.string().min(1).nullable(),
15
+ effort: z.string().min(1).nullable(),
16
+ })
17
+ .refine((choice) => (choice.provider === null) === (choice.model === null), {
18
+ error: "A provider and its model are picked together.",
19
+ });
20
+ export type ModelChoice = z.infer<typeof modelChoiceSchema>;
21
+
22
+ /** A pick that inherits everything. */
23
+ export const INHERIT_MODEL = {
24
+ provider: null,
25
+ model: null,
26
+ effort: null,
27
+ } satisfies ModelChoice;
28
+
29
+ /**
30
+ * An OpenAI-compatible endpoint as a server calls it: cc resolves the key
31
+ * from the provider's secret, and `efforts` are the values it accepts as
32
+ * `reasoning_effort`.
33
+ */
34
+ export const modelProviderEndpointSchema = z.object({
35
+ baseURL: z.url(),
36
+ apiKey: z.string().min(1),
37
+ efforts: z.array(z.string().min(1)),
38
+ });
39
+
40
+ /**
41
+ * The model picks a server needs to run one agent: its server's and the
42
+ * agent's own (each trigger carries its own on its declaration), plus every
43
+ * provider any of them names.
44
+ */
45
+ export const runtimeModelsSchema = z.object({
46
+ providers: z.record(z.string(), modelProviderEndpointSchema),
47
+ server: modelChoiceSchema,
48
+ agent: modelChoiceSchema,
49
+ });
50
+ export type RuntimeModels = z.infer<typeof runtimeModelsSchema>;
@@ -1,5 +1,6 @@
1
1
  import { z } from "zod";
2
2
  import { datasetIdentifierSchema } from "./datasets";
3
+ import { modelChoiceSchema } from "./models";
3
4
  import {
4
5
  agentRefSchema,
5
6
  agentSlugSchema,
@@ -122,6 +123,8 @@ export const triggerDeclarationSchema = z.object({
122
123
  /** Consecutive failed or rejected firings before the trigger disables itself. */
123
124
  disableAfterFailures: z.number().int().positive(),
124
125
  hasCredential: z.boolean(),
126
+ /** What runs of this trigger talk to, over the agent's pick; read live like the credential. */
127
+ modelChoice: modelChoiceSchema,
125
128
  /**
126
129
  * sha256 of the fire secret, so a server checks a presented bearer in
127
130
  * process; the Control Center hears only about console test secrets,
@@ -27,7 +27,7 @@ export type Database = "postgres" | "mssql";
27
27
  // sync (scripts/sync-package-versions.ts) restamps it and files.test.ts holds
28
28
  // them to that.
29
29
  export const DEPENDENCIES = {
30
- "@m6d/cortex-server": "~0.8.1",
30
+ "@m6d/cortex-server": "~0.9.0",
31
31
  "@tanstack/ai": "^0.55.0",
32
32
  "@tanstack/ai-openai": "^0.22.8",
33
33
  hono: "^4.12.3",
@@ -86,18 +86,10 @@ function packageJson(name: string) {
86
86
 
87
87
  /**
88
88
  * Never toggled, so they only ever appear commented out: `context` is fully
89
- * defaulted, and the other two are what you reach for once a real problem shows
90
- * up — noisy graph retrieval, a cheap-model path — not on day one.
89
+ * defaulted, and `reranker` is what you reach for once graph retrieval comes
90
+ * back noisy, not on day one.
91
91
  */
92
92
  const NEVER_SCAFFOLDED = [
93
- [
94
- "A cheaper, faster model for auxiliary passes. Same shape as `model`.",
95
- `fastModel: {
96
- baseURL: process.env["CORTEX_FAST_MODEL_URL"]!,
97
- apiKey: process.env["CORTEX_FAST_MODEL_KEY"]!,
98
- modelName: process.env["CORTEX_FAST_MODEL_NAME"]!,
99
- },`,
100
- ],
101
93
  [
102
94
  "Re-ranks knowledge-graph retrieval when it comes back noisy.",
103
95
  `reranker: {