@m6d/cortex-cli 1.10.0 → 1.11.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m6d/cortex-cli",
3
- "version": "1.10.0",
3
+ "version": "1.11.0",
4
4
  "description": "Scaffold and operate Cortex servers",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,9 +15,9 @@ export const TOOL_NAME_PATTERN = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/;
15
15
 
16
16
  /**
17
17
  * A variable the server fills per request: a session value, a request-context
18
- * value, or one the SDK computes. Declared per agent so the console offers
19
- * exactly what that agent's server provides, in prompts and as tool input
20
- * sources alike.
18
+ * value, or one the SDK computes. Declared once per server so the console
19
+ * offers exactly what that server provides to the agents created on it, in
20
+ * prompts and as tool input sources alike.
21
21
  */
22
22
  export const variableDeclarationSchema = z.object({
23
23
  name: z
@@ -30,6 +30,25 @@ export const variableDeclarationSchema = z.object({
30
30
  computed: z.boolean().default(false),
31
31
  });
32
32
 
33
+ /**
34
+ * Variables the SDK itself fills for every agent, listed first in a server's
35
+ * declaration so the console offers them like any consumer-declared one.
36
+ */
37
+ export const SDK_VARIABLES = [
38
+ {
39
+ name: "utcTime",
40
+ description: "Current time in UTC (ISO 8601)",
41
+ example: "2026-09-12T08:30:00Z",
42
+ computed: true,
43
+ },
44
+ {
45
+ name: "locale",
46
+ description: "Resolved locale of the session",
47
+ example: "ar",
48
+ computed: true,
49
+ },
50
+ ] as const satisfies ReadonlyArray<z.infer<typeof variableDeclarationSchema>>;
51
+
33
52
  export const RUNTIME_ERROR_KINDS = [
34
53
  "timeout",
35
54
  "upstream_4xx",
@@ -71,6 +90,20 @@ export const suggestionsSchema = z.record(
71
90
  .max(SUGGESTION_LIMITS.perLocale),
72
91
  );
73
92
  export type Suggestions = z.infer<typeof suggestionsSchema>;
93
+
94
+ /**
95
+ * The blank-chat landing's headline per locale. Empty means the widget's
96
+ * built-in default for that locale; like suggestions, served verbatim.
97
+ */
98
+ export const GREETING_MAX_LENGTH = 200;
99
+ export const greetingSchema = z.record(
100
+ localeSchema,
101
+ z
102
+ .string()
103
+ .max(GREETING_MAX_LENGTH)
104
+ .refine((text) => text === text.trim(), "greeting has surrounding whitespace"),
105
+ );
106
+ export type Greeting = z.infer<typeof greetingSchema>;
74
107
  export const catalogVersionSchema = z.string().regex(/^[0-9a-f]{16}$/);
75
108
 
76
109
  export const sharedShapeSchema = z.object({
@@ -275,19 +308,13 @@ export const triggerDeclarationSchema = z.object({
275
308
  });
276
309
 
277
310
  /**
278
- * What a server runs for one agent, sent whole at boot in `agent.declare`. An
279
- * agent exists in the Control Center only through a declaration, and only
280
- * its declaring server may serve it. Everything the console validates
281
- * against (variables, code skills, code triggers) is here rather than
282
- * assumed.
311
+ * What a server offers every agent the Control Center creates for it, sent
312
+ * whole at boot in `server.declare`: the `{{variables}}` its session loader
313
+ * and request context fill, SDK ones included. Agents in the server's own
314
+ * code never appear here; the Control Center is blind to them.
283
315
  */
284
- export const agentDeclarationSchema = z.object({
285
- slug: agentSlugSchema,
316
+ export const serverDeclarationSchema = z.object({
286
317
  variables: z.array(variableDeclarationSchema),
287
- skills: z.array(skillLineSchema),
288
- triggers: z.array(
289
- triggerDeclarationSchema.pick({ name: true, description: true, input: true, thread: true }),
290
- ),
291
318
  });
292
319
 
293
320
  export const triggerFiringResponseSchema = z.discriminatedUnion("outcome", [
@@ -395,6 +422,8 @@ export const runtimeAgentConfigSchema = z.object({
395
422
  messageTrigger: z.boolean().default(true),
396
423
  /** Operational like `messageTrigger`: edited on the agent row without republishing. */
397
424
  suggestions: suggestionsSchema,
425
+ /** Operational like `suggestions`. */
426
+ greeting: greetingSchema,
398
427
  /** Absent from older Control Centers; reports then carry only the slug. */
399
428
  agentRef: agentRefSchema.optional(),
400
429
  catalogVersion: catalogVersionSchema,
@@ -607,13 +636,12 @@ export const syncEventSchema = z.discriminatedUnion("type", [
607
636
  createdAt: z.iso.datetime(),
608
637
  finishedAt: z.iso.datetime().nullable(),
609
638
  }),
610
- // Everything the server runs, sent whole at boot. Replaces the server's
611
- // previous declaration, so an agent removed from code leaves cc with its
612
- // skills and triggers.
639
+ // What the server offers console-created agents, sent whole at boot and
640
+ // replacing the previous declaration.
613
641
  z.object({
614
- type: z.literal("agent.declare"),
642
+ type: z.literal("server.declare"),
615
643
  id: z.uuid(),
616
- agents: z.array(agentDeclarationSchema),
644
+ ...serverDeclarationSchema.shape,
617
645
  createdAt: z.iso.datetime(),
618
646
  }),
619
647
  ]);
@@ -654,7 +682,7 @@ export type ResolveResponse = z.infer<typeof resolveResponseSchema>;
654
682
  export type SkillLine = z.infer<typeof skillLineSchema>;
655
683
  export type SkillBodyResponse = z.infer<typeof skillBodyResponseSchema>;
656
684
  export type TriggerDeclaration = z.infer<typeof triggerDeclarationSchema>;
657
- export type AgentDeclaration = z.infer<typeof agentDeclarationSchema>;
685
+ export type ServerDeclaration = z.infer<typeof serverDeclarationSchema>;
658
686
  export type VariableDeclaration = z.infer<typeof variableDeclarationSchema>;
659
687
  export type TriggerThreadPolicy = z.infer<typeof triggerThreadPolicySchema>;
660
688
  export type TriggerOutcome = (typeof TRIGGER_OUTCOMES)[number];
@@ -101,6 +101,8 @@ export type AgentCapabilities = {
101
101
  messages: boolean;
102
102
  /** Prompt chips on the blank-chat landing per locale, the runtime contract's `suggestionsSchema` shape; clicking one sends it as the first message. */
103
103
  suggestions: Record<"en" | "ar", string[]>;
104
+ /** Headline of the blank-chat landing per locale; "" falls back to the widget's built-in copy. */
105
+ greeting: Record<"en" | "ar", string>;
104
106
  };
105
107
 
106
108
  export type MessageMetadata = {