@m6d/cortex-cli 0.21.0 → 0.23.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/package.json +1 -1
- package/src/commands/management.ts +8 -5
- package/src/commands/setup.ts +15 -8
- 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 +352 -184
- package/src/contracts/manifest/index.ts +186 -64
- package/src/contracts/runs/index.ts +187 -0
- package/src/contracts/schedule/index.ts +62 -0
- package/src/contracts/server/index.ts +101 -29
- package/src/contracts/triggers/index.ts +36 -93
- package/src/contracts/wire/index.ts +162 -55
- package/src/management/flags.ts +14 -4
- package/src/scaffold/files.ts +8 -3
- package/src/ui/prompts.ts +18 -24
package/package.json
CHANGED
|
@@ -98,7 +98,7 @@ async function login(given: string | undefined, name: string) {
|
|
|
98
98
|
const typed =
|
|
99
99
|
given ??
|
|
100
100
|
(prompts.canAsk()
|
|
101
|
-
? await prompts.askValue("Cortex URL", "https://cortex.example.com")
|
|
101
|
+
? await prompts.askValue("Cortex URL", { hint: "https://cortex.example.com" })
|
|
102
102
|
: report.fail({
|
|
103
103
|
what: "No terminal to ask for the Cortex URL",
|
|
104
104
|
blocks: ["Pass it with --url."],
|
|
@@ -544,13 +544,16 @@ async function collectInput(
|
|
|
544
544
|
return Object.fromEntries(body);
|
|
545
545
|
}
|
|
546
546
|
|
|
547
|
-
/** Asks for one field until the answer parses the way the flag would. */
|
|
547
|
+
/** Asks for one field until the answer parses the way the flag would; blank is `null` where allowed. */
|
|
548
548
|
async function askUntilValid(flag: Flag) {
|
|
549
|
-
const hint = flag.choices?.join(" | ") ?? flag.description
|
|
549
|
+
const hint = flag.choices?.join(" | ") ?? (flag.description || flag.kind);
|
|
550
550
|
for (;;) {
|
|
551
551
|
const answer = flag.sensitive
|
|
552
|
-
? await prompts.askSecret(flag.name)
|
|
553
|
-
: await prompts.askValue(flag.name,
|
|
552
|
+
? await prompts.askSecret(flag.name, { blank: flag.nullable })
|
|
553
|
+
: await prompts.askValue(flag.name, {
|
|
554
|
+
hint: flag.nullable ? `${hint} (blank for none)` : hint,
|
|
555
|
+
blank: flag.nullable,
|
|
556
|
+
});
|
|
554
557
|
const value = parseAnswer(flag, answer);
|
|
555
558
|
if (value !== undefined) return value;
|
|
556
559
|
report.note(`${flag.name} must be ${flag.choices ? `one of ${hint}` : `a ${flag.kind}`}.`);
|
package/src/commands/setup.ts
CHANGED
|
@@ -499,20 +499,27 @@ async function askAndSave() {
|
|
|
499
499
|
export async function askProvider() {
|
|
500
500
|
for (;;) {
|
|
501
501
|
const name = (
|
|
502
|
-
await prompts.askValue("Model provider name",
|
|
502
|
+
await prompts.askValue("Model provider name", {
|
|
503
|
+
hint: "openai",
|
|
504
|
+
check: issue("MODEL_PROVIDER_NAME"),
|
|
505
|
+
})
|
|
503
506
|
).trim();
|
|
504
507
|
const baseUrl = (
|
|
505
|
-
await prompts.askValue(
|
|
506
|
-
"
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
)
|
|
508
|
+
await prompts.askValue("Base URL", {
|
|
509
|
+
hint: "Any OpenAI-compatible URL, e.g. https://api.openai.com/v1",
|
|
510
|
+
check: issue("MODEL_PROVIDER_URL"),
|
|
511
|
+
})
|
|
510
512
|
)
|
|
511
513
|
.trim()
|
|
512
514
|
.replace(/\/+$/, "");
|
|
513
|
-
const apiKey = await prompts.askSecret("API key",
|
|
515
|
+
const apiKey = await prompts.askSecret("API key", {
|
|
516
|
+
check: issue("MODEL_PROVIDER_API_KEY"),
|
|
517
|
+
});
|
|
514
518
|
const model = (
|
|
515
|
-
await prompts.askValue("Model",
|
|
519
|
+
await prompts.askValue("Model", {
|
|
520
|
+
hint: "gpt-5-mini",
|
|
521
|
+
check: issue("MODEL_PROVIDER_MODEL"),
|
|
522
|
+
})
|
|
516
523
|
).trim();
|
|
517
524
|
const provider = { name, baseUrl, apiKey, model };
|
|
518
525
|
|
|
@@ -60,6 +60,27 @@ export type LocationResult = LatLng & { accuracy?: number };
|
|
|
60
60
|
|
|
61
61
|
export type RequestLocationOutcome = ClientToolOutcome<LocationResult>;
|
|
62
62
|
|
|
63
|
+
/**
|
|
64
|
+
* Asks the end user to connect their own account to an MCP server that signs
|
|
65
|
+
* in each end user. Its call is stamped with where the sign-in starts
|
|
66
|
+
* (`ConnectAccountBinding` in the wire contract).
|
|
67
|
+
*/
|
|
68
|
+
export const CONNECT_ACCOUNT_TOOL = "connectAccount";
|
|
69
|
+
|
|
70
|
+
/** The model's arguments: the MCP server to connect, by name. */
|
|
71
|
+
export type ConnectAccountInput = { server: string };
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* `completed` once the account is connected with the access it needs,
|
|
75
|
+
* `cancelled` when the end user said Not now or cancelled the sign-in,
|
|
76
|
+
* `failed` when the sign-in came back without that access, or ran out
|
|
77
|
+
* first.
|
|
78
|
+
*/
|
|
79
|
+
export type ConnectAccountOutcome = ClientToolOutcome<never>;
|
|
80
|
+
|
|
81
|
+
/** How long a sign-in Cortex starts stays open, and so how long the widget waits for its connection. */
|
|
82
|
+
export const SIGN_IN_TTL_MS = 10 * 60 * 1000;
|
|
83
|
+
|
|
63
84
|
/**
|
|
64
85
|
* Parse a `message` event into a handshake, or null when the origin doesn't
|
|
65
86
|
* match the tool's `embedOrigin` or the payload isn't a well-formed handshake.
|
|
@@ -79,7 +79,7 @@ export function isPrivateAddress(address: string) {
|
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
/** Loopback by its normalized spelling: `[::1]` arrives from a URL without its brackets. */
|
|
82
|
-
function isLoopback(hostname: string) {
|
|
82
|
+
export function isLoopback(hostname: string) {
|
|
83
83
|
return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1";
|
|
84
84
|
}
|
|
85
85
|
|