@zenera/cli 1.3.2 → 1.3.4

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.
Files changed (32) hide show
  1. package/dist/ask.d.ts +5 -5
  2. package/dist/ask.js +56 -18
  3. package/dist/catalog.d.ts +1 -1
  4. package/dist/catalog.js +11 -5
  5. package/dist/commands/init.js +8 -9
  6. package/dist/commands/inspect.js +12 -5
  7. package/dist/commands/key.js +2 -2
  8. package/dist/commands/models.js +9 -6
  9. package/dist/liveness.js +3 -2
  10. package/dist/modelref.d.ts +11 -6
  11. package/dist/modelref.js +23 -23
  12. package/dist/scaffold.js +4 -7
  13. package/dist/trace.js +1 -0
  14. package/dist/validate.js +31 -5
  15. package/package.json +6 -6
  16. package/templates/editor/.github/copilot-instructions.md +44 -14
  17. package/templates/editor/.github/skills/add-mcp/SKILL.md +40 -0
  18. package/templates/editor/.github/skills/zen-cli/references/keys.md +1 -1
  19. package/templates/editor/.github/skills/zen-cli/references/models.md +8 -8
  20. package/templates/editor/.github/skills/zen-cli/references/rag.md +1 -1
  21. package/templates/editor/.github/skills/zen-mcp/SKILL.md +139 -0
  22. package/templates/editor/.github/skills/zen-mcp/references/discovery.md +119 -0
  23. package/templates/editor/.github/skills/zen-mcp/references/install.md +148 -0
  24. package/templates/editor/.github/skills/zen-mcp/references/memory-cache.md +71 -0
  25. package/templates/editor/.github/skills/zen-mcp/references/runtime-skill.md +95 -0
  26. package/templates/editor/.github/skills/zen-memory/SKILL.md +2 -2
  27. package/templates/editor/.github/skills/zen-memory-warmup/SKILL.md +3 -3
  28. package/templates/editor/.github/skills/zen-rag-docs/SKILL.md +6 -6
  29. package/templates/editor/.github/skills/zen-rag-schema/SKILL.md +5 -5
  30. package/templates/parts/memory-terms.yaml.tmpl +1 -1
  31. package/templates/parts/models.yaml.tmpl +1 -1
  32. package/templates/project/scripts/_setup.sh +1 -1
package/dist/ask.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type LlmCallNode, type Message, type ModelRef, type ModelRequest, type ProjectConfig, type ToolSchema } from '@zenera/neo';
1
+ import { type LlmCallNode, type Message, type ModelRef, type ModelRegistry, type ModelRequest, type ProjectConfig, type ToolSchema } from '@zenera/neo';
2
2
  /**
3
3
  * Prepended to the system prompt the run recorded.
4
4
  *
@@ -43,9 +43,9 @@ export interface PickedModel {
43
43
  ref: ModelRef;
44
44
  /** how to name it to a reader */
45
45
  label: string;
46
- /** the wire id, to compare against the one the run answered with */
47
- id: string;
48
- from: 'flag' | 'agent' | 'project';
46
+ /** the model the run answered with, rather than a second opinion */
47
+ same: boolean;
48
+ from: 'flag' | 'agent' | 'project' | 'run';
49
49
  }
50
- export declare function pickModel(config: ProjectConfig, node: Pick<LlmCallNode, 'agent' | 'model'>, flag: string | undefined): PickedModel;
50
+ export declare function pickModel(config: ProjectConfig, node: Pick<LlmCallNode, 'agent' | 'model' | 'ref'>, flag: string | undefined, registry?: ModelRegistry): PickedModel;
51
51
  //# sourceMappingURL=ask.d.ts.map
package/dist/ask.js CHANGED
@@ -1,4 +1,4 @@
1
- import { text, } from '@zenera/neo';
1
+ import { projectRegistry, text, } from '@zenera/neo';
2
2
  import { splitRef } from "./modelref.js";
3
3
  import { invalidError } from "./term.js";
4
4
  // ---------------------------------------------------------------------------
@@ -120,24 +120,59 @@ function question(input) {
120
120
  lines.push('', '## question', '', input.query);
121
121
  return lines.join('\n');
122
122
  }
123
- function wireId(entry) {
124
- return typeof entry === 'string' ? splitRef(entry).id : entry.model;
123
+ /** The ref a declaration is written as today; undefined when it does not resolve. */
124
+ function refOf(registry, entry) {
125
+ try {
126
+ return registry.refOf(typeof entry === 'string' ? registry.parse(entry) : entry);
127
+ }
128
+ catch {
129
+ return undefined;
130
+ }
131
+ }
132
+ /**
133
+ * The wire ids a declaration can have been recorded under by an older run: the
134
+ * library once read only a colon as a provider, so `openai/gpt-5-mini` went out
135
+ * whole; `splitRef` has always split it; and Claude on Vertex is sent without
136
+ * its publisher.
137
+ */
138
+ function wireIds(registry, entry) {
139
+ const ids = new Set();
140
+ if (typeof entry === 'string') {
141
+ const colon = entry.indexOf(':');
142
+ ids.add(colon > 0 ? entry.slice(colon + 1) : entry);
143
+ ids.add(splitRef(entry).id);
144
+ try {
145
+ ids.add(registry.parse(entry).model);
146
+ }
147
+ catch {
148
+ // a ref that no longer resolves can still be what an old run used
149
+ }
150
+ }
151
+ else {
152
+ ids.add(entry.model);
153
+ }
154
+ for (const id of [...ids]) {
155
+ ids.add(id.replace(/^anthropic\/(?=claude-)/, ''));
156
+ }
157
+ return [...ids];
125
158
  }
126
- function labelOf(entry) {
127
- return typeof entry === 'string' ? entry : `${entry.provider ?? 'default'}/${entry.model}`;
159
+ function labelOf(registry, entry) {
160
+ return typeof entry === 'string' ? entry : (refOf(registry, entry) ?? entry.model);
128
161
  }
129
162
  /** A `model:` value is either a ref or a name in the `models:` map. */
130
163
  function declared(config, ref) {
131
164
  return config.models?.[ref] ?? ref;
132
165
  }
133
- export function pickModel(config, node, flag) {
166
+ export function pickModel(config, node, flag, registry = projectRegistry(config)) {
167
+ const answered = (entry) => node.ref
168
+ ? refOf(registry, entry) === node.ref
169
+ : wireIds(registry, entry).includes(node.model);
134
170
  if (flag) {
135
- return { ref: flag, label: flag, id: splitRef(flag).id, from: 'flag' };
171
+ return { ref: flag, label: flag, same: answered(flag), from: 'flag' };
136
172
  }
137
173
  const own = config.agents.find((a) => a.name === node.agent)?.model;
138
174
  // The agent's own declaration first, then anything else the project names:
139
- // a run made with `zen run --model` used something its agent never declared,
140
- // and the wire id is the only witness of which it was.
175
+ // a run made with `zen run --model` used something its agent never declared.
141
176
  const candidates = [
142
177
  ...(own ? [{ entry: declared(config, own), from: 'agent' }] : []),
143
178
  ...config.agents
@@ -152,15 +187,18 @@ export function pickModel(config, node, flag) {
152
187
  from: 'project',
153
188
  })),
154
189
  ];
155
- const found = candidates.find((c) => wireId(c.entry) === node.model);
156
- if (!found) {
157
- throw invalidError(`the run answered with "${node.model}", which this project does not declare`, 'name the model to ask: --model anthropic/claude-opus-5');
190
+ const found = candidates.find((c) => answered(c.entry));
191
+ if (found) {
192
+ return {
193
+ ref: found.entry,
194
+ label: labelOf(registry, found.entry),
195
+ same: true,
196
+ from: found.from,
197
+ };
158
198
  }
159
- return {
160
- ref: found.entry,
161
- label: labelOf(found.entry),
162
- id: wireId(found.entry),
163
- from: found.from,
164
- };
199
+ if (node.ref) {
200
+ return { ref: node.ref, label: node.ref, same: true, from: 'run' };
201
+ }
202
+ throw invalidError(`the run answered with "${node.model}", which this project does not declare`, 'name the model to ask: --model anthropic/claude-opus-5');
165
203
  }
166
204
  //# sourceMappingURL=ask.js.map
package/dist/catalog.d.ts CHANGED
@@ -7,7 +7,7 @@ import { type KeyCheck, type Provider } from '@zenera/engine';
7
7
  */
8
8
  export type Role = 'chat' | 'embedding' | 'image' | 'audio';
9
9
  export interface CatalogEntry {
10
- /** `provider:id` — paste-able straight into `agents.yaml` */
10
+ /** `provider/id` — paste-able straight into `agents.yaml` */
11
11
  ref: string;
12
12
  /** the id that goes on the wire, with any resource prefix already stripped */
13
13
  id: string;
package/dist/catalog.js CHANGED
@@ -20,6 +20,7 @@ import { GATEWAY_KEY_HEADER, GATEWAY_NAME, GATEWAY_UPSTREAMS, gatewayOf, ModelRe
20
20
  import { PROVIDERS } from '@zenera/engine';
21
21
  import { Cache, cacheKey } from "./cache.js";
22
22
  import { classify } from "./liveness.js";
23
+ import { catalogRef } from "./modelref.js";
23
24
  import { compareModels } from "./rank.js";
24
25
  /** A day. Model lists change on the scale of weeks; a stale row costs a retry. */
25
26
  export const CATALOG_TTL_MS = 24 * 60 * 60 * 1000;
@@ -101,7 +102,7 @@ export const PREFERRED = {
101
102
  function curated(provider) {
102
103
  return CURATED[provider].map((entry) => ({
103
104
  ...entry,
104
- ref: `${provider}:${entry.id}`,
105
+ ref: catalogRef(provider, entry.id),
105
106
  provider,
106
107
  source: 'curated',
107
108
  }));
@@ -129,7 +130,7 @@ const iso = (value) => {
129
130
  /** Drops empty optionals so a cached row does not carry a dozen `undefined`s. */
130
131
  function entry(provider, row) {
131
132
  const clean = Object.fromEntries(Object.entries(row).filter(([, v]) => v !== undefined && v !== null));
132
- return { ...clean, ref: `${provider}:${row.id}`, provider, source: 'live' };
133
+ return { ...clean, ref: catalogRef(provider, row.id), provider, source: 'live' };
133
134
  }
134
135
  /**
135
136
  * OpenAI's listing is three fields — id, created, owner — so the role has to be
@@ -482,9 +483,14 @@ export const catalogKey = (provider) => {
482
483
  };
483
484
  function readCache(provider) {
484
485
  const file = store().get(catalogKey(provider));
485
- return file && Array.isArray(file.entries) && typeof file.fetchedAt === 'string'
486
- ? file
487
- : undefined;
486
+ if (!file || !Array.isArray(file.entries) || typeof file.fetchedAt !== 'string') {
487
+ return undefined;
488
+ }
489
+ // Rows cached before refs were written `provider/id` say `provider:id`.
490
+ return {
491
+ ...file,
492
+ entries: file.entries.map((e) => ({ ...e, ref: catalogRef(e.provider, e.id) })),
493
+ };
488
494
  }
489
495
  /**
490
496
  * Through a gateway nothing is cached on disk: the gateway caches its own
@@ -5,6 +5,7 @@ import { basename, resolve } from 'node:path';
5
5
  import { one, parse } from "../args.js";
6
6
  import { PREFERRED } from "../catalog.js";
7
7
  import { probeAll } from "../liveness.js";
8
+ import { catalogRef, splitRef } from "../modelref.js";
8
9
  import { ensurePodmanReady } from "../podman.js";
9
10
  import { scaffold } from "../scaffold.js";
10
11
  import { bold, cyan, dim, green, json, note, progress, usageError, write, yellow, } from "../term.js";
@@ -24,7 +25,7 @@ const USAGE = 'zen init [dir] [--name <name>] [--model <ref>] [--force]';
24
25
  */
25
26
  const DEFAULT_MODEL = {
26
27
  openai: {
27
- ref: 'openai:gpt-5.4-mini',
28
+ ref: 'openai/gpt-5.4-mini',
28
29
  options: [
29
30
  '# Reasoning and tools only meet on the responses API — chat',
30
31
  '# completions, which is the default, rejects the two together.',
@@ -36,10 +37,10 @@ const DEFAULT_MODEL = {
36
37
  'reasoningSummary: auto',
37
38
  ].join('\n'),
38
39
  },
39
- anthropic: { ref: 'anthropic:claude-sonnet-4-5' },
40
- google: { ref: 'google:gemini-3.5-flash' },
41
- vertex: { ref: 'vertex:gemini-3.5-flash' },
42
- openrouter: { ref: 'openrouter:inclusionai/ling-3.0-flash-fin:free' },
40
+ anthropic: { ref: 'anthropic/claude-sonnet-4-5' },
41
+ google: { ref: 'google/gemini-3.5-flash' },
42
+ vertex: { ref: 'vertex/gemini-3.5-flash' },
43
+ openrouter: { ref: 'openrouter/inclusionai/ling-3.0-flash-fin:free' },
43
44
  };
44
45
  /**
45
46
  * What vectorises the project's memory, given the provider it ends up on.
@@ -57,7 +58,7 @@ function defaultEmbedding(provider) {
57
58
  return undefined;
58
59
  }
59
60
  const id = PREFERRED[provider].embedding[0];
60
- return id === undefined ? undefined : `${provider}:${id}`;
61
+ return id === undefined ? undefined : catalogRef(provider, id);
61
62
  }
62
63
  /**
63
64
  * The provider a model ref names, when it names one we know.
@@ -67,9 +68,7 @@ function defaultEmbedding(provider) {
67
68
  * for an explicit `--model`, where nothing else says which vendor was meant.
68
69
  */
69
70
  function providerOf(ref) {
70
- const colon = ref.indexOf(':');
71
- const head = colon < 0 ? '' : ref.slice(0, colon);
72
- return isProvider(head) ? head : undefined;
71
+ return splitRef(ref).provider;
73
72
  }
74
73
  /**
75
74
  * The provider this machine can actually reach.
@@ -423,12 +423,13 @@ async function ask(at, values, rest, cwd, asJson, interactive) {
423
423
  loadProjectEnv(project);
424
424
  (await KeyStore.open()).materialize();
425
425
  const { config } = readProjectConfig(project);
426
- const picked = pickModel(config, node, values.model);
427
- if (picked.id !== node.model) {
428
- note(yellow(`${picked.label} is answering for ${node.model} — ` +
426
+ const registry = projectRegistry(config);
427
+ const picked = pickModel(config, node, values.model, registry);
428
+ if (!picked.same) {
429
+ note(yellow(`${picked.label} is answering for ${node.ref ?? node.model} — ` +
429
430
  'a second opinion, not the model looking at itself'));
430
431
  }
431
- const model = projectRegistry(config).model(picked.ref);
432
+ const model = registry.model(picked.ref);
432
433
  const record = async (call) => {
433
434
  const startedAt = new Date();
434
435
  const res = await call();
@@ -459,7 +460,13 @@ async function ask(at, values, rest, cwd, asJson, interactive) {
459
460
  session: session.id,
460
461
  run: run.id,
461
462
  dir: run.dir,
462
- node: { id: entry.key, nodeId: node.id, agent: node.agent, model: node.model },
463
+ node: {
464
+ id: entry.key,
465
+ nodeId: node.id,
466
+ agent: node.agent,
467
+ model: node.model,
468
+ ...(node.ref ? { ref: node.ref } : {}),
469
+ },
463
470
  model: picked.label,
464
471
  query,
465
472
  answer: res.text,
@@ -693,8 +693,8 @@ export const key = {
693
693
  '',
694
694
  'A gateway holds one virtual key and its --url. In its mode every model',
695
695
  'goes through it, each in its own vendor protocol, and agents.yaml does',
696
- 'not change: vertex:gemini-3.5-flash reaches <url>/genai as',
697
- 'vertex/gemini-3.5-flash. Vendor keys are withheld from runs meanwhile.',
696
+ 'not change: vertex/gemini-3.5-flash reaches <url>/genai under that',
697
+ 'same name. Vendor keys are withheld from runs meanwhile.',
698
698
  '',
699
699
  ' zen key ls [--check] Everything stored, and its state.',
700
700
  ' zen key add <provider>[/name] Read a key from stdin, or ask for it.',
@@ -16,6 +16,7 @@ import { ensureHome, envNames, form, isProvider, KeyStore, PROVIDERS, } from '@z
16
16
  import { parse } from "../args.js";
17
17
  import { byGroup, groupOf, isPartner, loadCatalog, loadCatalogs, matches, routerBalance, sampleByProvider, } from "../catalog.js";
18
18
  import { probeChat, probeModel } from "../liveness.js";
19
+ import { catalogRef } from "../modelref.js";
19
20
  import { compareModels } from "../rank.js";
20
21
  import { ago, bold, CliError, credentialError, cut, cyan, dim, EXIT, green, isInteractive, json, note, plain, progress, red, table, usageError, write, writeAll, yellow, } from "../term.js";
21
22
  const USAGE = 'zen models <providers|ls|search|show|test|browse> [ref] [options]';
@@ -386,16 +387,18 @@ function split(ref) {
386
387
  spec = registry.parse(ref);
387
388
  }
388
389
  catch (err) {
389
- throw usageError(err instanceof Error ? err.message.split('\n')[0] : `bad reference "${ref}"`, 'expected provider:model — see: zen models ls');
390
+ throw usageError(err instanceof Error ? err.message.split('\n')[0] : `bad reference "${ref}"`, 'expected provider/model — see: zen models ls');
390
391
  }
391
392
  const provider = spec.provider ?? registry.defaultProvider;
392
393
  if (!isProvider(provider)) {
393
394
  throw usageError(`"${provider}" is not a provider this command knows`, `known: ${PROVIDERS.join(', ')}`);
394
395
  }
395
- return { provider, id: spec.model };
396
+ // The catalog keeps Claude on Vertex under its wire id, without the publisher.
397
+ const id = provider === 'vertex' ? spec.model.replace(/^anthropic\/(?=claude-)/, '') : spec.model;
398
+ return { provider, id };
396
399
  }
397
400
  const show = async (ctx, args) => {
398
- const { values, positionals } = parse(args, { refresh: { type: 'boolean' } }, 'zen models show <provider:model> [--refresh]');
401
+ const { values, positionals } = parse(args, { refresh: { type: 'boolean' } }, 'zen models show <provider/model> [--refresh]');
399
402
  const ref = positionals[0];
400
403
  if (!ref) {
401
404
  throw usageError('which model?', 'see: zen models ls');
@@ -405,14 +408,14 @@ const show = async (ctx, args) => {
405
408
  const cat = await loadCatalog(provider, { refresh: values.refresh });
406
409
  const found = cat.entries.find((e) => e.id === id);
407
410
  if (ctx.json) {
408
- json(found ?? { ref: `${provider}:${id}`, provider, id, known: false });
411
+ json(found ?? { ref: catalogRef(provider, id), provider, id, known: false });
409
412
  return;
410
413
  }
411
414
  announce(ctx, where);
412
415
  explain([cat]);
413
416
  if (!found) {
414
417
  note(`${yellow('not listed')} ${where.gateway ? GATEWAY_NAME : provider} does not advertise ${bold(id)}`);
415
- note(dim(`it may still work — try: zen models test ${provider}:${id}`));
418
+ note(dim(`it may still work — try: zen models test ${catalogRef(provider, id)}`));
416
419
  note(dim(`or look: zen models search ${id} --provider ${provider}`));
417
420
  return;
418
421
  }
@@ -521,7 +524,7 @@ function vertexAt(where) {
521
524
  return `vertex: project ${id ?? 'unset'} · location ${location}`;
522
525
  }
523
526
  const test = async (ctx, args) => {
524
- const { values, positionals } = parse(args, ROLE_OPTIONS, 'zen models test <provider:model> … [--chat|--embedding]');
527
+ const { values, positionals } = parse(args, ROLE_OPTIONS, 'zen models test <provider/model> … [--chat|--embedding]');
525
528
  if (positionals.length === 0) {
526
529
  throw usageError('which model?', 'see: zen models ls');
527
530
  }
package/dist/liveness.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { envOf, SHAPES, } from '@zenera/engine';
2
2
  import { createModel, EXA_BASE_URL, GATEWAY_KEY_HEADER, isUnfunded, ModelRegistry, text, vertexRoute, } from '@zenera/neo';
3
+ import { splitRef } from "./modelref.js";
3
4
  // ---------------------------------------------------------------------------
4
5
  // Liveness
5
6
  //
@@ -502,12 +503,12 @@ function limited(target) {
502
503
  return `${blame} — retry later`;
503
504
  }
504
505
  function responsesApi(target) {
505
- const provider = target.ref.includes(':') ? target.ref.split(':')[0].split('/')[0] : 'openai';
506
+ const provider = splitRef(target.ref).provider ?? 'openai';
506
507
  return `use the responses API: \`api: responses\` on the model, or the ref ${provider}/responses:${targetId(target)}`;
507
508
  }
508
509
  /** The command that finds something this account can actually use. */
509
510
  function instead(target) {
510
- const provider = target.ref.includes(':') ? target.ref.split(':')[0] : undefined;
511
+ const provider = splitRef(target.ref).provider;
511
512
  if (provider === 'vertex' && vertexRoute(targetId(target)) !== 'gemini') {
512
513
  return 'enable it for this project in Model Garden: https://console.cloud.google.com/vertex-ai/model-garden';
513
514
  }
@@ -1,16 +1,21 @@
1
1
  import type { Provider } from '@zenera/engine';
2
2
  export declare const PROVIDER_NAMES: ReadonlySet<string>;
3
3
  /**
4
- * `vertex/gemini-3.8-flash` splits; `gpt-5.6-sol` does not. Only a known provider
5
- * counts as a prefix, because `google/gemini-3.8-flash` is also a perfectly good
6
- * bare id on an endpoint that speaks publisher names.
4
+ * `vertex/gemini-3.8-flash` splits; `gpt-5.6-sol` does not. Only a known
5
+ * provider counts as a prefix, because `meta-llama/Llama-3-8B` is also a
6
+ * perfectly good bare id on an endpoint that speaks publisher names.
7
7
  *
8
- * The colon form is the library's own — `openai:gpt-5.6-sol`, and with an api
9
- * selector `openai/responses:gpt-5.6-sol` — which is what arrives when the ref
10
- * came from `agents.yaml`.
8
+ * Without a project's registry there is no default provider to weigh a slash
9
+ * against, so this is the plain reading; `ModelRegistry.parse` is the one a
10
+ * run uses.
11
11
  */
12
12
  export declare function splitRef(ref: string): {
13
13
  provider?: Provider;
14
14
  id: string;
15
15
  };
16
+ /**
17
+ * The ref `zen models` prints for a catalog row: `provider/id`, with Claude on
18
+ * Vertex under its publisher, as `ModelRegistry.refOf` writes it.
19
+ */
20
+ export declare function catalogRef(provider: Provider, id: string): string;
16
21
  //# sourceMappingURL=modelref.d.ts.map
package/dist/modelref.js CHANGED
@@ -1,9 +1,11 @@
1
+ import { formatModelRef, splitModelRef } from '@zenera/neo';
1
2
  // ---------------------------------------------------------------------------
2
3
  // Model refs as people type them
3
4
  //
4
- // `vertex/gemini-3.8-flash` from a person, `openai:gpt-5.6-sol` from
5
- // `agents.yaml`. Read by `zen inspect ask` and by `zen meta`, so it lives with
6
- // neither.
5
+ // `vertex/gemini-3.8-flash`, or the older `openai:gpt-5.6-sol`. Read by
6
+ // `zen inspect ask` and by `zen meta`, so it lives with neither; the grammar
7
+ // itself is the library's (`splitModelRef`), so the two cannot disagree on
8
+ // where a provider ends.
7
9
  // ---------------------------------------------------------------------------
8
10
  export const PROVIDER_NAMES = new Set([
9
11
  'openai',
@@ -12,30 +14,28 @@ export const PROVIDER_NAMES = new Set([
12
14
  'vertex',
13
15
  'openrouter',
14
16
  ]);
17
+ const isProviderName = (name) => PROVIDER_NAMES.has(name);
15
18
  /**
16
- * `vertex/gemini-3.8-flash` splits; `gpt-5.6-sol` does not. Only a known provider
17
- * counts as a prefix, because `google/gemini-3.8-flash` is also a perfectly good
18
- * bare id on an endpoint that speaks publisher names.
19
+ * `vertex/gemini-3.8-flash` splits; `gpt-5.6-sol` does not. Only a known
20
+ * provider counts as a prefix, because `meta-llama/Llama-3-8B` is also a
21
+ * perfectly good bare id on an endpoint that speaks publisher names.
19
22
  *
20
- * The colon form is the library's own — `openai:gpt-5.6-sol`, and with an api
21
- * selector `openai/responses:gpt-5.6-sol` — which is what arrives when the ref
22
- * came from `agents.yaml`.
23
+ * Without a project's registry there is no default provider to weigh a slash
24
+ * against, so this is the plain reading; `ModelRegistry.parse` is the one a
25
+ * run uses.
23
26
  */
24
27
  export function splitRef(ref) {
25
- const colon = ref.indexOf(':');
26
- if (colon > 0) {
27
- const head = ref.slice(0, colon).split('/')[0];
28
- if (PROVIDER_NAMES.has(head)) {
29
- return { provider: head, id: ref.slice(colon + 1) };
30
- }
31
- }
32
- const slash = ref.indexOf('/');
33
- if (slash < 0) {
34
- return { id: ref };
35
- }
36
- const head = ref.slice(0, slash);
37
- return PROVIDER_NAMES.has(head)
38
- ? { provider: head, id: ref.slice(slash + 1) }
28
+ const parts = splitModelRef(ref, isProviderName);
29
+ return parts.provider && isProviderName(parts.provider)
30
+ ? { provider: parts.provider, id: parts.model }
39
31
  : { id: ref };
40
32
  }
33
+ /**
34
+ * The ref `zen models` prints for a catalog row: `provider/id`, with Claude on
35
+ * Vertex under its publisher, as `ModelRegistry.refOf` writes it.
36
+ */
37
+ export function catalogRef(provider, id) {
38
+ const model = provider === 'vertex' && /^claude-/.test(id) ? `anthropic/${id}` : id;
39
+ return formatModelRef(provider, model, isProviderName);
40
+ }
41
41
  //# sourceMappingURL=modelref.js.map
package/dist/scaffold.js CHANGED
@@ -8,6 +8,7 @@ import { chmodSync, existsSync, mkdirSync, readdirSync, readFileSync, writeFileS
8
8
  import { dirname, join, sep } from 'node:path';
9
9
  import { fileURLToPath } from 'node:url';
10
10
  import { editorFiles } from "./editor.js";
11
+ import { splitRef } from "./modelref.js";
11
12
  // ---------------------------------------------------------------------------
12
13
  // Scaffolding
13
14
  //
@@ -118,15 +119,11 @@ function part(name, vars = {}) {
118
119
  * configuration a name to be referred to by.
119
120
  */
120
121
  function modelSection(ref, options) {
121
- const colon = ref.indexOf(':');
122
- if (!options || colon < 0) {
122
+ const { provider, id } = splitRef(ref);
123
+ if (!options || !provider) {
123
124
  return part('model.yaml', { ref });
124
125
  }
125
- return part('models.yaml', {
126
- provider: ref.slice(0, colon),
127
- id: ref.slice(colon + 1),
128
- options,
129
- });
126
+ return part('models.yaml', { provider, id, options });
130
127
  }
131
128
  /**
132
129
  * Template files that land under a name they cannot be stored under.
package/dist/trace.js CHANGED
@@ -627,6 +627,7 @@ function factsOf(n) {
627
627
  case 'llm_call':
628
628
  return {
629
629
  model: n.model,
630
+ ...(n.ref && n.ref !== n.model ? { ref: n.ref } : {}),
630
631
  stopReason: n.stopReason,
631
632
  tokens: `${n.usage.inputTokens} in, ${n.usage.outputTokens} out` +
632
633
  (n.usage.reasoningTokens ? `, ${n.usage.reasoningTokens} thinking` : ''),
package/dist/validate.js CHANGED
@@ -1571,6 +1571,32 @@ function siblings(skillFile) {
1571
1571
  // ---------------------------------------------------------------------------
1572
1572
  // Models
1573
1573
  // ---------------------------------------------------------------------------
1574
+ /**
1575
+ * A ref that resolves, but is not written the way a ref is written today. Only
1576
+ * the ambiguous one is a warning: it means what it always meant, and the next
1577
+ * reader will take it for something else.
1578
+ */
1579
+ function refStyle(registry, ref, where, add) {
1580
+ const style = registry.refStyle(ref);
1581
+ if (!style) {
1582
+ return;
1583
+ }
1584
+ const fallback = registry.defaultProvider;
1585
+ const message = {
1586
+ bare: `\`${ref}\` names no provider, so it goes to the default one, ${fallback}`,
1587
+ colon: `\`${ref}\` is the older colon form`,
1588
+ ambiguous: `\`${ref}\` is read as a ${fallback} model id, not as a model of ` +
1589
+ `${ref.slice(0, ref.indexOf('/'))}: ${fallback} names its models with slashes`,
1590
+ publisher: `\`${ref}\` leaves out the model's publisher`,
1591
+ }[style.issue];
1592
+ add({
1593
+ severity: style.issue === 'ambiguous' ? 'warning' : 'note',
1594
+ code: `model.ref.${style.issue}`,
1595
+ where,
1596
+ message,
1597
+ fix: `write \`${style.canonical}\` — the same model, from the same provider`,
1598
+ });
1599
+ }
1574
1600
  function checkModels(root, config, keys, add, probe = false) {
1575
1601
  let registry;
1576
1602
  try {
@@ -1656,11 +1682,13 @@ function checkModels(root, config, keys, add, probe = false) {
1656
1682
  // report says what it stands for — otherwise `main was refused`
1657
1683
  // names nothing anyone can look up or retype.
1658
1684
  const spec = typeof ref === 'string' ? registry.parse(ref) : ref;
1659
- const api = 'api' in spec && spec.api ? `/${spec.api}` : '';
1660
- const resolved = `${need.provider}${api}:${spec.model}`;
1685
+ const resolved = registry.refOf(spec);
1661
1686
  if (resolved !== name) {
1662
1687
  report.ref = resolved;
1663
1688
  }
1689
+ if (typeof ref === 'string') {
1690
+ refStyle(registry, ref, whereFor(config, role, name, usedBy), add);
1691
+ }
1664
1692
  // Reported here rather than left to the probe below: a knob for the
1665
1693
  // wrong vendor is a config mistake that wants naming whether or not
1666
1694
  // there is a credential to build the model with.
@@ -1683,9 +1711,7 @@ function checkModels(root, config, keys, add, probe = false) {
1683
1711
  code: `${role}.unresolvable`,
1684
1712
  where: whereFor(config, role, name, usedBy),
1685
1713
  message: err instanceof Error ? err.message : String(err),
1686
- fix: role === 'embedding'
1687
- ? 'a reference is `[provider:]model`; see docs/agents-yaml.md'
1688
- : 'a reference is `[provider[/api]:]model`; see docs/agents-yaml.md',
1714
+ fix: 'a reference is `provider/model`; see docs/agents-yaml.md',
1689
1715
  });
1690
1716
  report.credential = 'unknown';
1691
1717
  models.push(report);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenera/cli",
3
- "version": "1.3.2",
3
+ "version": "1.3.4",
4
4
  "description": "Command-line front end for @zenera/neo: agentic projects you can run, share and commit.",
5
5
  "keywords": [
6
6
  "agents",
@@ -56,11 +56,11 @@
56
56
  "@google/genai": "^2.30.0",
57
57
  "@inkjs/ui": "^2.0.0",
58
58
  "@openrouter/sdk": "^1.4.25",
59
- "@zenera/engine": "^1.3.2",
60
- "@zenera/neo": "^1.3.2",
61
- "@zenera/sandbox": "^1.3.2",
62
- "@zenera/server": "^1.3.2",
63
- "@zenera/view": "^1.3.2",
59
+ "@zenera/engine": "^1.3.4",
60
+ "@zenera/neo": "^1.3.4",
61
+ "@zenera/sandbox": "^1.3.4",
62
+ "@zenera/server": "^1.3.4",
63
+ "@zenera/view": "^1.3.4",
64
64
  "google-auth-library": "^10.0.0",
65
65
  "ink": "^7.1.1",
66
66
  "openai": "^6.0.0",