@zenera/cli 1.3.3 → 1.3.5
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/dist/ask.d.ts +5 -5
- package/dist/ask.js +56 -18
- package/dist/catalog.d.ts +1 -1
- package/dist/catalog.js +11 -5
- package/dist/commands/init.js +8 -9
- package/dist/commands/inspect.js +12 -5
- package/dist/commands/key.js +2 -2
- package/dist/commands/models.js +9 -6
- package/dist/liveness.js +3 -2
- package/dist/modelref.d.ts +11 -6
- package/dist/modelref.js +23 -23
- package/dist/scaffold.js +16 -8
- package/dist/trace.js +1 -0
- package/dist/validate.js +107 -9
- package/package.json +6 -6
- package/templates/editor/.github/copilot-instructions.md +60 -20
- package/templates/editor/.github/skills/add-mcp/SKILL.md +43 -0
- package/templates/editor/.github/skills/finetune/SKILL.md +2 -1
- package/templates/editor/.github/skills/zen-analyze-run/SKILL.md +4 -2
- package/templates/editor/.github/skills/zen-cli/references/keys.md +1 -1
- package/templates/editor/.github/skills/zen-cli/references/models.md +8 -8
- package/templates/editor/.github/skills/zen-cli/references/projects.md +2 -0
- package/templates/editor/.github/skills/zen-cli/references/rag.md +1 -1
- package/templates/editor/.github/skills/zen-finetune/SKILL.md +2 -1
- package/templates/editor/.github/skills/zen-finetune-apply/SKILL.md +3 -2
- package/templates/editor/.github/skills/zen-inspect-ask/SKILL.md +2 -1
- package/templates/editor/.github/skills/zen-instructions/SKILL.md +50 -37
- package/templates/editor/.github/skills/zen-mcp/SKILL.md +142 -0
- package/templates/editor/.github/skills/zen-mcp/references/discovery.md +120 -0
- package/templates/editor/.github/skills/zen-mcp/references/install.md +159 -0
- package/templates/editor/.github/skills/zen-mcp/references/memory-cache.md +73 -0
- package/templates/editor/.github/skills/zen-memory/SKILL.md +2 -2
- package/templates/editor/.github/skills/zen-memory-warmup/SKILL.md +3 -3
- package/templates/editor/.github/skills/zen-rag-docs/SKILL.md +6 -6
- package/templates/editor/.github/skills/zen-rag-schema/SKILL.md +5 -5
- package/templates/editor/.github/skills/zen-review/SKILL.md +5 -3
- package/templates/editor/.github/skills/zen-review/scripts/check-paths.sh +3 -2
- package/templates/editor/.github/skills/zen-spec-sync/SKILL.md +2 -1
- package/templates/editor/.github/skills/zen-spec-sync/scripts/snapshot.sh +1 -1
- package/templates/parts/memory-terms.yaml.tmpl +1 -1
- package/templates/parts/models.yaml.tmpl +1 -1
- package/templates/project/agents/mcp-instructions.md +66 -0
- package/templates/project/agents/mcp-memory-instructions.md +28 -0
- 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
|
|
47
|
-
|
|
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
|
-
|
|
124
|
-
|
|
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 :
|
|
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,
|
|
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) =>
|
|
156
|
-
if (
|
|
157
|
-
|
|
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
|
-
|
|
160
|
-
ref:
|
|
161
|
-
|
|
162
|
-
|
|
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
|
|
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:
|
|
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:
|
|
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
|
-
|
|
486
|
-
|
|
487
|
-
|
|
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
|
package/dist/commands/init.js
CHANGED
|
@@ -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
|
|
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
|
|
40
|
-
google: { ref: 'google
|
|
41
|
-
vertex: { ref: 'vertex
|
|
42
|
-
openrouter: { ref: 'openrouter
|
|
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 :
|
|
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
|
-
|
|
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.
|
package/dist/commands/inspect.js
CHANGED
|
@@ -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
|
|
427
|
-
|
|
428
|
-
|
|
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 =
|
|
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: {
|
|
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,
|
package/dist/commands/key.js
CHANGED
|
@@ -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
|
|
697
|
-
'
|
|
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.',
|
package/dist/commands/models.js
CHANGED
|
@@ -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
|
|
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
|
-
|
|
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
|
|
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:
|
|
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
|
|
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
|
|
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 =
|
|
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
|
|
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
|
}
|
package/dist/modelref.d.ts
CHANGED
|
@@ -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
|
|
5
|
-
* counts as a prefix, because `
|
|
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
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
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
|
|
5
|
-
// `
|
|
6
|
-
//
|
|
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
|
|
17
|
-
* counts as a prefix, because `
|
|
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
|
-
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
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
|
|
26
|
-
|
|
27
|
-
|
|
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
|
//
|
|
@@ -47,6 +48,10 @@ const MEMORY_RULES = join('agents', 'memory-instructions.md');
|
|
|
47
48
|
const TOOL_RULES = join('agents', 'tools-instructions.md');
|
|
48
49
|
/** How forking behaves: the same again, reaching only agents that declare `fork:`. */
|
|
49
50
|
const FORK_RULES = join('agents', 'fork-instructions.md');
|
|
51
|
+
/** How the `mcp` tools are used: reaching only agents granted that group. */
|
|
52
|
+
const MCP_RULES = join('agents', 'mcp-instructions.md');
|
|
53
|
+
/** What an MCP agent with a store commits about its calls: routes, never results. */
|
|
54
|
+
const MCP_MEMORY_RULES = join('agents', 'mcp-memory-instructions.md');
|
|
50
55
|
/**
|
|
51
56
|
* The project files that are ours rather than the project's.
|
|
52
57
|
*
|
|
@@ -59,7 +64,14 @@ const FORK_RULES = join('agents', 'fork-instructions.md');
|
|
|
59
64
|
* place: project policy on any of those subjects goes in a topic file of its
|
|
60
65
|
* own beside them.
|
|
61
66
|
*/
|
|
62
|
-
export const SHARED_RULES = [
|
|
67
|
+
export const SHARED_RULES = [
|
|
68
|
+
FILE_RULES,
|
|
69
|
+
FORK_RULES,
|
|
70
|
+
MCP_RULES,
|
|
71
|
+
MCP_MEMORY_RULES,
|
|
72
|
+
MEMORY_RULES,
|
|
73
|
+
TOOL_RULES,
|
|
74
|
+
];
|
|
63
75
|
/**
|
|
64
76
|
* This `zen`'s own version, which the scaffold pins the sandbox's tools to.
|
|
65
77
|
* The publishable packages move in lockstep, so one number covers them all.
|
|
@@ -118,15 +130,11 @@ function part(name, vars = {}) {
|
|
|
118
130
|
* configuration a name to be referred to by.
|
|
119
131
|
*/
|
|
120
132
|
function modelSection(ref, options) {
|
|
121
|
-
const
|
|
122
|
-
if (!options ||
|
|
133
|
+
const { provider, id } = splitRef(ref);
|
|
134
|
+
if (!options || !provider) {
|
|
123
135
|
return part('model.yaml', { ref });
|
|
124
136
|
}
|
|
125
|
-
return part('models.yaml', {
|
|
126
|
-
provider: ref.slice(0, colon),
|
|
127
|
-
id: ref.slice(colon + 1),
|
|
128
|
-
options,
|
|
129
|
-
});
|
|
137
|
+
return part('models.yaml', { provider, id, options });
|
|
130
138
|
}
|
|
131
139
|
/**
|
|
132
140
|
* 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` : ''),
|