@m6d/cortex-cli 0.8.1 → 0.10.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 +2 -2
- package/package.json +1 -1
- package/src/contracts/runtime/api.ts +8 -1
- package/src/contracts/runtime/index.ts +1 -0
- package/src/contracts/runtime/models.ts +50 -0
- package/src/contracts/runtime/triggers.ts +3 -0
- package/src/contracts/wire/index.ts +9 -2
- package/src/scaffold/files.ts +3 -11
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 `
|
|
48
|
-
|
|
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
|
@@ -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
|
|
|
@@ -115,7 +116,7 @@ const toolSignatureBaseSchema = z.object({
|
|
|
115
116
|
* binding, so the schema travels with it.
|
|
116
117
|
*/
|
|
117
118
|
requiresApproval: z.boolean(),
|
|
118
|
-
/** The
|
|
119
|
+
/** The action the widget's approval card names before an approval-gated call runs; only such tools carry one. */
|
|
119
120
|
approvalMessage: localizedTextSchema.optional(),
|
|
120
121
|
tags: z.array(z.string()),
|
|
121
122
|
signature: z.string(),
|
|
@@ -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,
|
|
@@ -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,
|
|
@@ -142,8 +142,15 @@ export type Greeting = Record<Locale, string>;
|
|
|
142
142
|
export type LocalizedText = Record<Locale, string>;
|
|
143
143
|
|
|
144
144
|
/**
|
|
145
|
-
*
|
|
146
|
-
*
|
|
145
|
+
* Cortex's own tools whose input carries `status`: the model's one-line
|
|
146
|
+
* statement of the call, which the widget draws in place of a generic label.
|
|
147
|
+
* Any other tool's `status` is that tool's own data.
|
|
148
|
+
*/
|
|
149
|
+
export const STATEMENT_TOOLS = ["executeCode", "queryDataset", "describeDataset"] as const;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* What cortex stamps on a tool-call part's `metadata.cortex`: the action the
|
|
153
|
+
* approval card names when the call needs the user's approval, in the
|
|
147
154
|
* author's words rather than the function's name.
|
|
148
155
|
*/
|
|
149
156
|
export type ToolCallMetadata = {
|
package/src/scaffold/files.ts
CHANGED
|
@@ -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.
|
|
30
|
+
"@m6d/cortex-server": "~0.10.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
|
|
90
|
-
*
|
|
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: {
|