@m6d/cortex-cli 0.20.0 → 0.22.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 +3 -3
- package/package.json +1 -1
- package/src/commands/new.ts +4 -4
- package/src/commands/setup.ts +19 -10
- package/src/contracts/client-tools/index.ts +21 -0
- package/src/contracts/egress-policy/index.ts +1 -0
- package/src/contracts/egress-policy/url.ts +1 -1
- package/src/contracts/management/procedures.generated.ts +452 -171
- package/src/contracts/manifest/index.ts +121 -106
- package/src/contracts/server/index.ts +35 -10
- package/src/contracts/triggers/index.ts +9 -9
- package/src/contracts/wire/index.ts +54 -0
- package/src/scaffold/files.ts +11 -13
package/src/scaffold/files.ts
CHANGED
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
* a standalone scaffold has no workspace.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { NAME_MAX_LENGTH } from "@cortex/contracts/manifest";
|
|
12
|
-
|
|
13
11
|
import pkg from "../../package.json";
|
|
14
12
|
import serverTs from "@/scaffold/templates/server.ts.txt";
|
|
15
13
|
import setupTs from "@/scaffold/templates/setup.ts.txt";
|
|
@@ -30,7 +28,7 @@ import { applyPorts, type Ports } from "@/scaffold/ports";
|
|
|
30
28
|
* `@m6d/cortex` range below are stamped by scripts/sync-package-versions.ts
|
|
31
29
|
* before the CLI publishes, so a scaffold pins what was current then.
|
|
32
30
|
*/
|
|
33
|
-
const CORTEX_VERSION = "0.
|
|
31
|
+
const CORTEX_VERSION = "0.21.0";
|
|
34
32
|
|
|
35
33
|
/** This machine as Cortex's containers name it: the one private host the stack's egress policy admits. */
|
|
36
34
|
export const DOCKER_HOST = "host.docker.internal";
|
|
@@ -40,9 +38,9 @@ const SERVER_URL = `http://${DOCKER_HOST}:{{port.server}}`;
|
|
|
40
38
|
|
|
41
39
|
/**
|
|
42
40
|
* The agent the manifest declares and the README sends you to chat with.
|
|
43
|
-
* Not `assistant`: Cortex holds that
|
|
41
|
+
* Not `assistant`: Cortex holds that name for its console's own assistant.
|
|
44
42
|
*/
|
|
45
|
-
export const
|
|
43
|
+
export const AGENT_NAME = "helper";
|
|
46
44
|
|
|
47
45
|
/**
|
|
48
46
|
* The embedding model the stack asks for, and the dimension the image's
|
|
@@ -111,7 +109,7 @@ function runAll(runner: "mprocs" | "concurrently", processes: Record<string, str
|
|
|
111
109
|
return `${runner} --names ${Object.keys(processes).join(",")} ${commands.join(" ")}`;
|
|
112
110
|
}
|
|
113
111
|
|
|
114
|
-
/** The name as the manifest `id`
|
|
112
|
+
/** The name as the manifest `id` and the server's name take it: lowercase words and hyphens. */
|
|
115
113
|
export function manifestIdOf(name: string) {
|
|
116
114
|
return name
|
|
117
115
|
.replace(/[^a-z0-9]+/g, "-")
|
|
@@ -149,7 +147,7 @@ function packageJson({ name, datasets, setup }: Project) {
|
|
|
149
147
|
verify: "bun run format:check && bun run lint && bun run spellcheck && bun run check && bun run audit",
|
|
150
148
|
},
|
|
151
149
|
dependencies: {
|
|
152
|
-
"@m6d/cortex": "~0.
|
|
150
|
+
"@m6d/cortex": "~0.9.0",
|
|
153
151
|
// drizzle 1.0 is in beta; this is the build `@m6d/cortex/drizzle` is tested against.
|
|
154
152
|
...(datasets ? { "drizzle-orm": "1.0.0-beta.15-859cf75" } : {}),
|
|
155
153
|
hono: "^4.12.3",
|
|
@@ -218,8 +216,8 @@ export default defineManifest({
|
|
|
218
216
|
id: ${JSON.stringify(manifestIdOf(name))},
|
|
219
217
|
agents: [
|
|
220
218
|
{
|
|
221
|
-
|
|
222
|
-
|
|
219
|
+
name: "${AGENT_NAME}",
|
|
220
|
+
displayName: { en: "Helper" },
|
|
223
221
|
server,
|
|
224
222
|
prompt: "You are a helpful assistant. Address the user as {{userName}}.",
|
|
225
223
|
// No identity provider yet: each browser is a visitor of its own.
|
|
@@ -460,7 +458,7 @@ function readme({ name, server, datasets, setup }: Project) {
|
|
|
460
458
|
const gettingStarted = setup
|
|
461
459
|
? `That starts Cortex (\`docker compose up\`), this backend, and \`cortex setup\` in one dashboard.
|
|
462
460
|
Setup waits for Cortex, registers this backend as the server \`${server}\`, adds the model provider
|
|
463
|
-
in \`.env\`, and applies the manifest. Then it prints where to chat with \`${
|
|
461
|
+
in \`.env\`, and applies the manifest. Then it prints where to chat with \`${AGENT_NAME}\`, and the first
|
|
464
462
|
time, how to sign in. It adds only what is missing, so every \`bun run dev\` runs it again.
|
|
465
463
|
|
|
466
464
|
While \`MODEL_PROVIDER_*\` in \`.env\` is blank, setup registers the server and applies nothing:
|
|
@@ -487,7 +485,7 @@ A backend for Cortex agents, and Cortex itself to run them on.
|
|
|
487
485
|
? "\n- `datasets.ts` serves an `orders` table as a dataset host, for agents to ask grouped\n questions of."
|
|
488
486
|
: ""
|
|
489
487
|
}
|
|
490
|
-
- \`cortex.manifest.ts\` declares the \`${
|
|
488
|
+
- \`cortex.manifest.ts\` declares the \`${AGENT_NAME}\` agent on this server${
|
|
491
489
|
datasets ? " and the dataset host" : ""
|
|
492
490
|
}. \`cortex apply\` makes Cortex match it.
|
|
493
491
|
- \`docker-compose.yml\` runs Cortex: its app, worker and engine, and the stores they use.
|
|
@@ -507,7 +505,7 @@ bun run dev
|
|
|
507
505
|
|
|
508
506
|
${gettingStarted}
|
|
509
507
|
|
|
510
|
-
Then chat with \`${
|
|
508
|
+
Then chat with \`${AGENT_NAME}\` on the console's **Playground** page. Edit \`cortex.manifest.ts\` and run
|
|
511
509
|
\`bun cortex apply\` to change it; an apply changes only what the edit changed. The CLI reaches this
|
|
512
510
|
checkout's Cortex through \`CORTEX_URL\` and \`CORTEX_KEY\` in \`.env\`, so it needs no login, and
|
|
513
511
|
\`-p <profile>\` picks a saved one instead.
|
|
@@ -538,7 +536,7 @@ pre-commit hook or CI job should run. Each is also available on its own: \`forma
|
|
|
538
536
|
* are drawn by the caller.
|
|
539
537
|
*/
|
|
540
538
|
export function scaffoldFiles(input: Input) {
|
|
541
|
-
const project = { ...input, server: input.name
|
|
539
|
+
const project = { ...input, server: manifestIdOf(input.name) };
|
|
542
540
|
const files = {
|
|
543
541
|
"server.ts": serverTs,
|
|
544
542
|
"setup.ts": setupTs,
|