@zenera/cli 1.2.8 → 1.3.1

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 (107) hide show
  1. package/README.md +11 -3
  2. package/dist/command.d.ts +19 -0
  3. package/dist/command.js +5 -9
  4. package/dist/commands/index.d.ts +1 -1
  5. package/dist/commands/index.js +13 -3
  6. package/dist/commands/open.js +6 -1
  7. package/dist/commands/version.d.ts +11 -0
  8. package/dist/commands/version.js +129 -19
  9. package/dist/{completion.d.ts → complete.d.ts} +1 -1
  10. package/dist/{completion.js → complete.js} +14 -4
  11. package/dist/{meta/editor.js → editor.js} +7 -1
  12. package/dist/lib.d.ts +18 -1
  13. package/dist/lib.js +34 -0
  14. package/dist/main.js +1 -1
  15. package/dist/scaffold.js +7 -1
  16. package/package.json +6 -7
  17. package/templates/editor/.github/skills/zen-cli/references/meta.md +3 -0
  18. package/templates/editor/.github/skills/zen-cli/references/projects.md +7 -2
  19. package/dist/commands/meta.d.ts +0 -6
  20. package/dist/commands/meta.js +0 -1088
  21. package/dist/meta/finetune/analyze-brief.d.ts +0 -26
  22. package/dist/meta/finetune/analyze-brief.js +0 -131
  23. package/dist/meta/finetune/apply-brief.d.ts +0 -23
  24. package/dist/meta/finetune/apply-brief.js +0 -247
  25. package/dist/meta/finetune/brief.d.ts +0 -45
  26. package/dist/meta/finetune/brief.js +0 -158
  27. package/dist/meta/finetune/children.d.ts +0 -8
  28. package/dist/meta/finetune/children.js +0 -76
  29. package/dist/meta/finetune/command.d.ts +0 -30
  30. package/dist/meta/finetune/command.js +0 -516
  31. package/dist/meta/finetune/cost.d.ts +0 -46
  32. package/dist/meta/finetune/cost.js +0 -105
  33. package/dist/meta/finetune/dataset/anchors.d.ts +0 -41
  34. package/dist/meta/finetune/dataset/anchors.js +0 -239
  35. package/dist/meta/finetune/dataset/changes.d.ts +0 -36
  36. package/dist/meta/finetune/dataset/changes.js +0 -319
  37. package/dist/meta/finetune/dataset/command.d.ts +0 -17
  38. package/dist/meta/finetune/dataset/command.js +0 -1011
  39. package/dist/meta/finetune/dataset/drift.d.ts +0 -33
  40. package/dist/meta/finetune/dataset/drift.js +0 -71
  41. package/dist/meta/finetune/dataset/export.d.ts +0 -26
  42. package/dist/meta/finetune/dataset/export.js +0 -51
  43. package/dist/meta/finetune/dataset/index.d.ts +0 -2
  44. package/dist/meta/finetune/dataset/index.js +0 -2
  45. package/dist/meta/finetune/dataset/sample.d.ts +0 -50
  46. package/dist/meta/finetune/dataset/sample.js +0 -197
  47. package/dist/meta/finetune/dataset/schema.d.ts +0 -33
  48. package/dist/meta/finetune/dataset/schema.js +0 -216
  49. package/dist/meta/finetune/dataset/store.d.ts +0 -35
  50. package/dist/meta/finetune/dataset/store.js +0 -177
  51. package/dist/meta/finetune/dataset/types.d.ts +0 -127
  52. package/dist/meta/finetune/dataset/types.js +0 -39
  53. package/dist/meta/finetune/failure.d.ts +0 -15
  54. package/dist/meta/finetune/failure.js +0 -26
  55. package/dist/meta/finetune/feedback.d.ts +0 -57
  56. package/dist/meta/finetune/feedback.js +0 -104
  57. package/dist/meta/finetune/improvements.d.ts +0 -98
  58. package/dist/meta/finetune/improvements.js +0 -501
  59. package/dist/meta/finetune/index.d.ts +0 -2
  60. package/dist/meta/finetune/index.js +0 -2
  61. package/dist/meta/finetune/journal.d.ts +0 -35
  62. package/dist/meta/finetune/journal.js +0 -135
  63. package/dist/meta/finetune/live.d.ts +0 -84
  64. package/dist/meta/finetune/live.js +0 -272
  65. package/dist/meta/finetune/loop.d.ts +0 -3
  66. package/dist/meta/finetune/loop.js +0 -163
  67. package/dist/meta/finetune/memories.d.ts +0 -47
  68. package/dist/meta/finetune/memories.js +0 -171
  69. package/dist/meta/finetune/recheck.d.ts +0 -58
  70. package/dist/meta/finetune/recheck.js +0 -311
  71. package/dist/meta/finetune/report.d.ts +0 -40
  72. package/dist/meta/finetune/report.js +0 -1397
  73. package/dist/meta/finetune/retry.d.ts +0 -24
  74. package/dist/meta/finetune/retry.js +0 -96
  75. package/dist/meta/finetune/sampler.d.ts +0 -18
  76. package/dist/meta/finetune/sampler.js +0 -47
  77. package/dist/meta/finetune/system.d.ts +0 -27
  78. package/dist/meta/finetune/system.js +0 -132
  79. package/dist/meta/finetune/train.d.ts +0 -43
  80. package/dist/meta/finetune/train.js +0 -425
  81. package/dist/meta/finetune/tui.d.ts +0 -16
  82. package/dist/meta/finetune/tui.js +0 -316
  83. package/dist/meta/finetune/tuning.d.ts +0 -193
  84. package/dist/meta/finetune/tuning.js +0 -308
  85. package/dist/meta/finetune/usage.d.ts +0 -66
  86. package/dist/meta/finetune/usage.js +0 -260
  87. package/dist/meta/finetune/view.d.ts +0 -9
  88. package/dist/meta/finetune/view.js +0 -27
  89. package/dist/meta/host.d.ts +0 -16
  90. package/dist/meta/host.js +0 -22
  91. package/dist/meta/index.d.ts +0 -11
  92. package/dist/meta/index.js +0 -11
  93. package/dist/meta/launch.d.ts +0 -81
  94. package/dist/meta/launch.js +0 -288
  95. package/dist/meta/model.d.ts +0 -61
  96. package/dist/meta/model.js +0 -146
  97. package/dist/meta/prompts.d.ts +0 -23
  98. package/dist/meta/prompts.js +0 -84
  99. package/dist/meta/relay.d.ts +0 -20
  100. package/dist/meta/relay.js +0 -123
  101. package/dist/meta/tokens.d.ts +0 -52
  102. package/dist/meta/tokens.js +0 -226
  103. package/dist/meta/window.d.ts +0 -61
  104. package/dist/meta/window.js +0 -198
  105. package/dist/meta/wire.d.ts +0 -51
  106. package/dist/meta/wire.js +0 -159
  107. /package/dist/{meta/editor.d.ts → editor.d.ts} +0 -0
@@ -1,198 +0,0 @@
1
- import { boxWidth, cut, cyan, dim, formatMarkdown, note, pad, red, styled, write } from "./host.js";
2
- export const terminalSink = {
3
- answer: (text) => write(text),
4
- narrate: (line) => note(line),
5
- warn: (line) => note(red(line)),
6
- };
7
- /** Rows of narration the window keeps on screen. */
8
- export const WINDOW_ROWS = 8;
9
- const BOX = { tl: '╭', tr: '╮', bl: '╰', br: '╯', h: '─', v: '│' };
10
- /** How often the border is redrawn — the wave's frame, not the clock's. */
11
- export const FRAME_MS = 80;
12
- // Dimmest first, crest last. Written as escapes rather than `styleText` because
13
- // a named colour has no ramp, which is also why `styled()` has to be asked.
14
- const WAVE = [
15
- '\u001b[0;38;5;24m',
16
- '\u001b[0;38;5;31m',
17
- '\u001b[0;38;5;38m',
18
- '\u001b[0;38;5;45m',
19
- '\u001b[0;38;5;51m',
20
- '\u001b[1;38;5;159m',
21
- '\u001b[1;38;5;231m',
22
- ];
23
- const RESET = '\u001b[0m';
24
- /** Cells each tone of the tail covers, so the crest reads as a band, not a dot. */
25
- const WAVE_TAIL = 2;
26
- /** Cells the crest travels per frame — a lap of a wide window in a few seconds. */
27
- export const WAVE_STEP = 3;
28
- /**
29
- * How brightly one cell of the border is lit, given where the crest has got to.
30
- *
31
- * `position` counts clockwise from the top left corner, so one index walks the
32
- * whole ring and the wave rounds the corners without a seam. Everything the
33
- * tail has passed sits at the dimmest tone, which is the border's resting
34
- * colour: the ring is always drawn, only the crest moves.
35
- */
36
- export function toneAt(position, head, span) {
37
- const behind = (((head - position) % span) + span) % span;
38
- const step = Math.floor(behind / WAVE_TAIL);
39
- return step < WAVE.length ? WAVE.length - 1 - step : 0;
40
- }
41
- /**
42
- * A run of border cells, coloured by the wave and emitting an escape only where
43
- * the tone changes — a frame of the whole ring is a handful of them.
44
- *
45
- * `from` is the ring position of the first cell and `step` which way round the
46
- * ring the cells run, because the bottom rule is printed left to right while
47
- * the ring travels it right to left.
48
- */
49
- function lit(cells, from, step, head, span) {
50
- let out = '';
51
- let tone = -1;
52
- for (let i = 0; i < cells.length; i++) {
53
- const next = toneAt(from + i * step, head, span);
54
- if (next !== tone) {
55
- out += WAVE[next];
56
- tone = next;
57
- }
58
- out += cells[i];
59
- }
60
- return `${out}${RESET}`;
61
- }
62
- /**
63
- * The bottom rule as cells, with the status label set into it near the left.
64
- *
65
- * Waiting belongs to the frame rather than to the narration: a row of its own
66
- * costs a step of what the agent is doing every time, and it settles just
67
- * under the last line, which is where the eye already is. Near the left, where
68
- * reading starts, and not so near that it displaces the corner.
69
- */
70
- export function footerCells(label, width) {
71
- const room = width - 6;
72
- const text = label && room > 0 ? [...label].slice(0, room) : [];
73
- const cells = text.length > 0 ? [BOX.bl, BOX.h, ' ', ...text, ' '] : [BOX.bl];
74
- while (cells.length < width - 1) {
75
- cells.push(BOX.h);
76
- }
77
- return [...cells, BOX.br];
78
- }
79
- /**
80
- * Narration held to a fixed number of rows that rewrite themselves in place.
81
- *
82
- * A long run is hundreds of tool calls, and printing each as its own line
83
- * scrolls the question, the model line and every warning off the top of the
84
- * screen — by the end the terminal holds a transcript nobody asked for and the
85
- * answer is somewhere in the middle of it. Only the last few steps say what it
86
- * is doing now, which is the only thing narration is for; the rest is in the
87
- * session copilot recorded.
88
- *
89
- * Warnings are not narration: they leave the window and stay on the screen.
90
- *
91
- * Without a terminal there is nothing to rewrite over, so every line is its
92
- * own — which is what a CI log wants anyway.
93
- */
94
- export function windowSink(rows = WINDOW_ROWS) {
95
- if (!process.stderr.isTTY) {
96
- return terminalSink;
97
- }
98
- const kept = [];
99
- const colour = styled();
100
- let label = '';
101
- let head = 0;
102
- let painted = 0;
103
- // The frame must stay under the viewport: a block taller than the screen
104
- // scrolls its own top away, and then the cursor-up erase falls short and
105
- // strands a copy of every repaint. The two border rows count towards it.
106
- const height = () => Math.max(1, Math.min(rows, (process.stderr.rows ?? 24) - 4));
107
- const columns = () => Math.max(20, (process.stderr.columns ?? 80) - 1);
108
- const innerOf = () => columns() - 4;
109
- const erase = () => {
110
- if (painted > 0) {
111
- process.stderr.write(`\u001b[${painted}A\u001b[0J`);
112
- painted = 0;
113
- }
114
- };
115
- /** The whole frame, border lit by the wave, every row exactly one row. */
116
- const frameOf = (show, inner) => {
117
- const width = inner + 4;
118
- // Clockwise from the top left: across the top, down the right, back
119
- // along the bottom, up the left. One ring, so one index addresses it.
120
- const span = 2 * width + 2 * show.length;
121
- const top = [BOX.tl, ...Array(width - 2).fill(BOX.h), BOX.tr];
122
- const bottom = footerCells(label, width);
123
- const edge = (position) => colour ? lit([BOX.v], position, 1, head, span) : cyan(BOX.v);
124
- return [
125
- colour ? lit(top, 0, 1, head, span) : cyan(top.join('')),
126
- ...show.map((line, r) => `${edge(span - 1 - r)} ${pad(cut(line, inner), inner)} ${edge(width + r)}`),
127
- colour
128
- ? lit(bottom, 2 * width + show.length - 1, -1, head, span)
129
- : cyan(bottom.join('')),
130
- ];
131
- };
132
- const paint = () => {
133
- const show = kept.slice(-height());
134
- if (show.length === 0 && label === '') {
135
- erase();
136
- return;
137
- }
138
- // The wave wants a frame to run round before there is anything to say.
139
- const lines = frameOf(show.length > 0 ? show : [''], innerOf());
140
- if (painted === lines.length) {
141
- // Erasing before a repaint is what flickers; overwriting in place
142
- // does not, and at frame rate the whole border has to be redrawn.
143
- process.stderr.write(`\u001b[${painted}A${lines.map((l) => `\r${l}\u001b[0K\n`).join('')}`);
144
- return;
145
- }
146
- erase();
147
- process.stderr.write(lines.map((l) => `${l}\n`).join(''));
148
- painted = lines.length;
149
- };
150
- return {
151
- answer: (text) => {
152
- erase();
153
- write(text);
154
- },
155
- narrate: (line) => {
156
- kept.push(...line.split('\n'));
157
- if (kept.length > height() * 4) {
158
- kept.splice(0, kept.length - height());
159
- }
160
- paint();
161
- },
162
- warn: (line) => {
163
- erase();
164
- note(red(line));
165
- paint();
166
- },
167
- status: (line) => {
168
- label = line;
169
- head += WAVE_STEP;
170
- paint();
171
- },
172
- close: erase,
173
- };
174
- }
175
- /**
176
- * The answer in the same box `zen run` draws it in: bounded width, rounded
177
- * rule, formatted with full markdown styling (bold, italics, code, lists, quotes, tables).
178
- *
179
- * Redirected output gets the text and nothing else — `zen meta run ... > out.md`
180
- * is meant to produce a file you can read, not one with a border down its side.
181
- */
182
- export function answerBox(text, columns = process.stdout.columns ?? 80) {
183
- if (!process.stdout.isTTY) {
184
- return text.split('\n');
185
- }
186
- const outer = boxWidth(text, columns);
187
- const inner = outer - 4;
188
- const body = formatMarkdown(text, inner);
189
- const rule = BOX.h.repeat(outer - 2);
190
- return [
191
- '',
192
- dim(`${BOX.tl}${rule}${BOX.tr}`),
193
- ...body.map((l) => `${dim(BOX.v)} ${pad(l, inner)} ${dim(BOX.v)}`),
194
- dim(`${BOX.bl}${rule}${BOX.br}`),
195
- '',
196
- ];
197
- }
198
- //# sourceMappingURL=window.js.map
@@ -1,51 +0,0 @@
1
- import { type Gateway } from '@zenera/neo';
2
- import { type KeyEntry, type KeyStore, type Provider } from './host.ts';
3
- /**
4
- * Copilot offers its tools as OpenAI *custom* tools, which the completions API
5
- * rejects outright — `400 Invalid value: 'custom'`. Only the responses API
6
- * takes them, and only the reasoning models serve it, so the wire API follows
7
- * the model rather than being a flag nobody would know to set. Older models are
8
- * listed rather than newer ones, so each new generation works without a release.
9
- */
10
- export declare function wireApi(provider: Provider, id: string): string | undefined;
11
- /** Whether copilot's tools survive the model: OpenAI's completions-only models refuse them. */
12
- export declare function metaCompatible(provider: Provider, id: string): boolean;
13
- export interface Wiring {
14
- provider: Provider;
15
- /** what the model is called on the wire */
16
- model: string;
17
- /** every `COPILOT_*` name and value, ready to hand to the child */
18
- env: Record<string, string>;
19
- /** names whose values are secret, for `--secret-env-vars` and for masking */
20
- secret: string[];
21
- /** anything true but unwelcome: a location that will be slow, a stale default */
22
- warnings: string[];
23
- /** Claude on Vertex: a loopback relay to start, whose url becomes the base url */
24
- relay?: {
25
- key: string;
26
- project: string;
27
- location: string;
28
- keyFile: string;
29
- };
30
- }
31
- /** Where the relay's url goes once it is listening. */
32
- export declare const RELAY_URL = "http://127.0.0.1:<relay>";
33
- /**
34
- * Turns a zen key entry and a model id into copilot's environment.
35
- *
36
- * `COPILOT_PROVIDER_BASE_URL` is what activates BYOK at all, so every provider
37
- * gets one — including OpenAI, whose url copilot would otherwise have reached
38
- * through a GitHub account we are deliberately not using.
39
- */
40
- export declare function wire(store: KeyStore, entry: KeyEntry, id: string): Wiring;
41
- /**
42
- * Through a gateway: one virtual key, and Bifrost's OpenAI or Anthropic drop-in,
43
- * which routes on an `<upstream>/<id>` wire model. Claude speaks Anthropic
44
- * wherever it is hosted; everything else goes through the OpenAI one.
45
- */
46
- export declare function wireGateway(at: Gateway, provider: Provider, id: string): Wiring;
47
- /** Values a `--dry-run` may print. A key is four characters and an apology. */
48
- export declare function masked(env: Record<string, string>, secret: readonly string[]): string[];
49
- /** Non-fatal, said once, because a competing file is a silent override. */
50
- export declare function providersWarning(): string | undefined;
51
- //# sourceMappingURL=wire.d.ts.map
package/dist/meta/wire.js DELETED
@@ -1,159 +0,0 @@
1
- import { GATEWAY_UPSTREAMS } from '@zenera/neo';
2
- import { randomBytes } from 'node:crypto';
3
- import { existsSync } from 'node:fs';
4
- import { credentialError, envOf, invokedAs, yellow, } from "./host.js";
5
- const TYPES = {
6
- openai: 'openai',
7
- anthropic: 'anthropic',
8
- google: 'openai',
9
- vertex: 'openai',
10
- openrouter: 'openai',
11
- };
12
- const BASE_URLS = {
13
- openai: 'https://api.openai.com/v1',
14
- anthropic: 'https://api.anthropic.com',
15
- google: 'https://generativelanguage.googleapis.com/v1beta/openai/',
16
- openrouter: 'https://openrouter.ai/api/v1',
17
- };
18
- /**
19
- * Copilot offers its tools as OpenAI *custom* tools, which the completions API
20
- * rejects outright — `400 Invalid value: 'custom'`. Only the responses API
21
- * takes them, and only the reasoning models serve it, so the wire API follows
22
- * the model rather than being a flag nobody would know to set. Older models are
23
- * listed rather than newer ones, so each new generation works without a release.
24
- */
25
- export function wireApi(provider, id) {
26
- return provider === 'openai' && !/^(gpt-4|gpt-3\.5|chatgpt-)/.test(id)
27
- ? 'responses'
28
- : undefined;
29
- }
30
- /** Whether copilot's tools survive the model: OpenAI's completions-only models refuse them. */
31
- export function metaCompatible(provider, id) {
32
- return provider !== 'openai' || wireApi(provider, id) !== undefined;
33
- }
34
- /** Where the relay's url goes once it is listening. */
35
- export const RELAY_URL = 'http://127.0.0.1:<relay>';
36
- const vertexClaude = (id) => /^(anthropic\/)?claude-/.test(id);
37
- /**
38
- * Turns a zen key entry and a model id into copilot's environment.
39
- *
40
- * `COPILOT_PROVIDER_BASE_URL` is what activates BYOK at all, so every provider
41
- * gets one — including OpenAI, whose url copilot would otherwise have reached
42
- * through a GitHub account we are deliberately not using.
43
- */
44
- export function wire(store, entry, id) {
45
- const provider = entry.provider;
46
- const env = {};
47
- const secret = [];
48
- const warnings = [];
49
- env.COPILOT_PROVIDER_TYPE = TYPES[provider];
50
- env.COPILOT_MODEL = id;
51
- if (provider === 'vertex' && vertexClaude(id)) {
52
- const project = store.projectOf(entry)?.id;
53
- if (entry.holds !== 'file' || !project) {
54
- throw credentialError(`Claude on vertex needs a service account and a GCP project, not ${entry.provider}/${entry.name}`, 'add one: zen key add vertex --project <id>');
55
- }
56
- const model = id.replace(/^anthropic\//, '');
57
- const key = randomBytes(24).toString('hex');
58
- env.COPILOT_PROVIDER_TYPE = 'anthropic';
59
- env.COPILOT_MODEL = model;
60
- env.COPILOT_PROVIDER_BASE_URL = RELAY_URL;
61
- env.COPILOT_PROVIDER_API_KEY = key;
62
- return {
63
- provider,
64
- model,
65
- env,
66
- secret: ['COPILOT_PROVIDER_API_KEY'],
67
- warnings,
68
- relay: {
69
- key,
70
- project,
71
- location: entry.location?.trim() || 'global',
72
- keyFile: store.fileOf(entry),
73
- },
74
- };
75
- }
76
- if (provider === 'vertex') {
77
- const project = store.projectOf(entry)?.id;
78
- if (!project) {
79
- throw credentialError(`no GCP project on ${entry.provider}/${entry.name}`, 'set one: zen key add vertex --project <id>');
80
- }
81
- const named = entry.location?.trim() || 'global';
82
- const partner = id.includes('/') && !id.startsWith('google/');
83
- // Gemini serves the `us`/`eu` multi-regions; partner models answer them with a 404 or 429.
84
- const location = partner && (named === 'us' || named === 'eu') ? 'global' : named;
85
- if (location === 'global' && !partner) {
86
- warnings.push('location `global` adds about ten seconds of cold start');
87
- }
88
- env.COPILOT_PROVIDER_BASE_URL = `https://aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/endpoints/openapi`;
89
- // Vertex speaks publisher names on the wire and knows nothing of zen's
90
- // provider prefix; the bare id stays as the model *id* so copilot can
91
- // still match its catalogue for token limits and tool support.
92
- env.COPILOT_PROVIDER_WIRE_MODEL = id.includes('/') ? id : `google/${id}`;
93
- // Only Google's own ids are bare: `gpt-oss-…` would get GPT's custom `apply_patch`, which this endpoint rejects.
94
- env.COPILOT_PROVIDER_MODEL_ID = id.startsWith('google/') ? id.slice('google/'.length) : id;
95
- }
96
- else {
97
- const url = BASE_URLS[provider];
98
- if (!url) {
99
- throw credentialError(`no BYOK endpoint known for ${provider}`);
100
- }
101
- env.COPILOT_PROVIDER_BASE_URL = url;
102
- }
103
- const api = wireApi(provider, id);
104
- if (api) {
105
- env.COPILOT_PROVIDER_WIRE_API = api;
106
- }
107
- if (entry.holds === 'file') {
108
- // A Google access token is good for an hour and a session is not, so
109
- // copilot is told how to mint one rather than handed one that will be
110
- // stale by the time it matters.
111
- env.COPILOT_PROVIDER_API_KEY_COMMAND = `${invokedAs('zen')} key token ${entry.provider}`;
112
- env[envOf(entry)] = store.fileOf(entry);
113
- }
114
- else {
115
- env.COPILOT_PROVIDER_API_KEY = store.reveal(entry);
116
- secret.push('COPILOT_PROVIDER_API_KEY');
117
- }
118
- return { provider, model: env.COPILOT_PROVIDER_WIRE_MODEL ?? id, env, secret, warnings };
119
- }
120
- /**
121
- * Through a gateway: one virtual key, and Bifrost's OpenAI or Anthropic drop-in,
122
- * which routes on an `<upstream>/<id>` wire model. Claude speaks Anthropic
123
- * wherever it is hosted; everything else goes through the OpenAI one.
124
- */
125
- export function wireGateway(at, provider, id) {
126
- const claude = provider === 'anthropic' || (provider === 'vertex' && vertexClaude(id));
127
- const model = provider === 'vertex' ? id.replace(/^anthropic\//, '') : id;
128
- const env = {
129
- COPILOT_PROVIDER_TYPE: claude ? 'anthropic' : 'openai',
130
- COPILOT_PROVIDER_BASE_URL: `${at.baseURL}${claude ? '/anthropic' : '/openai/v1'}`,
131
- COPILOT_PROVIDER_MODEL_ID: model.replace(/^google\//, ''),
132
- COPILOT_PROVIDER_WIRE_MODEL: `${GATEWAY_UPSTREAMS[provider]}/${model}`,
133
- };
134
- const api = wireApi(provider, model);
135
- if (api) {
136
- env.COPILOT_PROVIDER_WIRE_API = api;
137
- }
138
- const secret = [];
139
- if (at.apiKey) {
140
- env.COPILOT_PROVIDER_API_KEY = at.apiKey;
141
- secret.push('COPILOT_PROVIDER_API_KEY');
142
- }
143
- return { provider, model: env.COPILOT_PROVIDER_WIRE_MODEL, env, secret, warnings: [] };
144
- }
145
- /** Values a `--dry-run` may print. A key is four characters and an apology. */
146
- export function masked(env, secret) {
147
- return Object.entries(env)
148
- .sort(([a], [b]) => a.localeCompare(b))
149
- .map(([name, value]) => `${name}=${secret.includes(name) ? '••••' : value}`);
150
- }
151
- /** Non-fatal, said once, because a competing file is a silent override. */
152
- export function providersWarning() {
153
- const configured = process.env.COPILOT_PROVIDERS_CONFIG;
154
- const path = configured ?? `${process.env.HOME ?? ''}/.copilot/providers.json`;
155
- return existsSync(path)
156
- ? yellow(`${path} may override the provider zen just wired`)
157
- : undefined;
158
- }
159
- //# sourceMappingURL=wire.js.map
File without changes