@aui.io/apollo 0.1.39 → 0.1.41
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/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +131 -27
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/vault.js +3 -4
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/vault.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/index.js +0 -2
- package/node_modules/@aui.io/apollo-cli/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/package.json +3 -3
- package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.d.ts +11 -100
- package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js +0 -17
- package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.d.ts +71 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js +17 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/builder-api.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/vault.d.ts +8 -23
- package/node_modules/@aui.io/apollo-core/dist/src/api/vault.js +4 -23
- package/node_modules/@aui.io/apollo-core/dist/src/api/vault.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.d.ts +12 -1
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.js +8 -2
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/baseline.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.d.ts +15 -0
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.js +121 -0
- package/node_modules/@aui.io/apollo-core/dist/src/bundle/build-area.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +3 -4
- package/node_modules/@aui.io/apollo-core/dist/src/index.js +0 -1
- package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.d.ts +54 -5
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +189 -36
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/evaluations.d.ts +42 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/evaluations.js +106 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/evaluations.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/vault.d.ts +2 -3
- package/node_modules/@aui.io/apollo-core/dist/src/services/vault.js +12 -12
- package/node_modules/@aui.io/apollo-core/dist/src/services/vault.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/package.json +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js +0 -28
- package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/activity/operationStore.js +0 -3
- package/node_modules/@aui.io/apollo-tui/dist/src/activity/operationStore.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.d.ts +1 -3
- package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.js +3 -3
- package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +4 -90
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.d.ts +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js +0 -50
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js +15 -159
- package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.d.ts +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.js +0 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.js.map +1 -1
- package/node_modules/@aui.io/apollo-tui/package.json +2 -2
- package/package.json +4 -4
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.d.ts +0 -3
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.js +0 -124
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.js.map +0 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.d.ts +0 -158
- package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.js +0 -481
- package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.js.map +0 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/author/ScenariosView.d.ts +0 -22
- package/node_modules/@aui.io/apollo-tui/dist/src/author/ScenariosView.js +0 -99
- package/node_modules/@aui.io/apollo-tui/dist/src/author/ScenariosView.js.map +0 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.d.ts +0 -47
- package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.js +0 -284
- package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.js.map +0 -1
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Scenarios service — the agent's evaluation suite as checkout files.
|
|
3
|
-
*
|
|
4
|
-
* Local layout (beside `bundle/`, never inside it — the program scan must
|
|
5
|
-
* not ship eval cases to the runtime):
|
|
6
|
-
*
|
|
7
|
-
* <checkout>/scenarios/
|
|
8
|
-
* scenarios.json { "scenarios": [ { code, goal, description, …extra } ] }
|
|
9
|
-
* scores.json last evaluation result (written by the scoring skill)
|
|
10
|
-
* intent/ raw source material: intent docs, sample data
|
|
11
|
-
*
|
|
12
|
-
* Remote truth is agent-settings: opaque build bundles (any relative path,
|
|
13
|
-
* versioned) and evaluation scores (append-only per agent version). The
|
|
14
|
-
* wire uses those relative paths as-is; everything here speaks the local
|
|
15
|
-
* `scenarios/` layout only.
|
|
16
|
-
*/
|
|
17
|
-
import { mkdir, readdir, readFile, stat, writeFile } from "node:fs/promises";
|
|
18
|
-
import path from "node:path";
|
|
19
|
-
import { ApiError, CliError, ConfigError, ValidationError, } from "../errors/index.js";
|
|
20
|
-
import { createClients } from "./clients.js";
|
|
21
|
-
import { resolveSendVersion } from "./messaging.js";
|
|
22
|
-
// ─── Layout ───
|
|
23
|
-
export const SCENARIOS_DIR = "scenarios";
|
|
24
|
-
export const SCENARIOS_FILE = "scenarios.json";
|
|
25
|
-
export const SCORES_FILE = "scores.json";
|
|
26
|
-
export const INTENT_DIR = "intent";
|
|
27
|
-
/** Server-enforced cap per uploaded file. */
|
|
28
|
-
const MAX_FILE_BYTES = 5 * 1024 * 1024;
|
|
29
|
-
export function scenariosPaths(checkoutRoot) {
|
|
30
|
-
const dir = path.join(checkoutRoot, SCENARIOS_DIR);
|
|
31
|
-
return {
|
|
32
|
-
dir,
|
|
33
|
-
intentDir: path.join(dir, INTENT_DIR),
|
|
34
|
-
scenariosFile: path.join(dir, SCENARIOS_FILE),
|
|
35
|
-
scoresFile: path.join(dir, SCORES_FILE),
|
|
36
|
-
};
|
|
37
|
-
}
|
|
38
|
-
function clientsFor(context, options) {
|
|
39
|
-
return (options.clients ??
|
|
40
|
-
createClients(context, options.fetch ? { fetch: options.fetch } : {}));
|
|
41
|
-
}
|
|
42
|
-
function fetchFor(options) {
|
|
43
|
-
return options.fetch ?? globalThis.fetch;
|
|
44
|
-
}
|
|
45
|
-
// ─── JSON helpers ───
|
|
46
|
-
async function writeJson(filePath, data) {
|
|
47
|
-
await mkdir(path.dirname(filePath), { recursive: true });
|
|
48
|
-
await writeFile(filePath, `${JSON.stringify(data, null, 2)}\n`, "utf8");
|
|
49
|
-
}
|
|
50
|
-
async function readJson(filePath) {
|
|
51
|
-
let raw;
|
|
52
|
-
try {
|
|
53
|
-
raw = await readFile(filePath, "utf8");
|
|
54
|
-
}
|
|
55
|
-
catch {
|
|
56
|
-
return undefined;
|
|
57
|
-
}
|
|
58
|
-
if (!raw.trim())
|
|
59
|
-
return undefined;
|
|
60
|
-
try {
|
|
61
|
-
return JSON.parse(raw);
|
|
62
|
-
}
|
|
63
|
-
catch (error) {
|
|
64
|
-
throw new CliError(`Failed to parse ${path.basename(filePath)}: ${error instanceof Error ? error.message : String(error)}`, { code: "INVALID_JSON", suggestion: "Fix the JSON syntax and try again." });
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
// ─── Local read / write ───
|
|
68
|
-
export async function readLocalScenarios(checkoutRoot) {
|
|
69
|
-
const data = await readJson(scenariosPaths(checkoutRoot).scenariosFile);
|
|
70
|
-
if (data === undefined)
|
|
71
|
-
return undefined;
|
|
72
|
-
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
|
73
|
-
throw new ValidationError(`${SCENARIOS_FILE} must be a JSON object with a "scenarios" array.`);
|
|
74
|
-
}
|
|
75
|
-
const scenarios = data.scenarios;
|
|
76
|
-
if (!Array.isArray(scenarios)) {
|
|
77
|
-
throw new ValidationError(`${SCENARIOS_FILE} must have a top-level "scenarios" array.`);
|
|
78
|
-
}
|
|
79
|
-
return { scenarios: scenarios };
|
|
80
|
-
}
|
|
81
|
-
export async function writeLocalScenarios(checkoutRoot, data) {
|
|
82
|
-
await writeJson(scenariosPaths(checkoutRoot).scenariosFile, data);
|
|
83
|
-
}
|
|
84
|
-
export async function readLocalScores(checkoutRoot) {
|
|
85
|
-
const data = await readJson(scenariosPaths(checkoutRoot).scoresFile);
|
|
86
|
-
if (data === undefined)
|
|
87
|
-
return undefined;
|
|
88
|
-
if (typeof data !== "object" || data === null || Array.isArray(data)) {
|
|
89
|
-
throw new ValidationError(`${SCORES_FILE} must be a JSON object.`);
|
|
90
|
-
}
|
|
91
|
-
return data;
|
|
92
|
-
}
|
|
93
|
-
export async function writeLocalScores(checkoutRoot, data) {
|
|
94
|
-
const rows = data.scenarios ?? [];
|
|
95
|
-
const total = data.total_scenarios ?? rows.length;
|
|
96
|
-
const pass = data.pass_scenarios ?? rows.filter((row) => row.status === "pass").length;
|
|
97
|
-
await writeJson(scenariosPaths(checkoutRoot).scoresFile, {
|
|
98
|
-
...data,
|
|
99
|
-
total_scenarios: total,
|
|
100
|
-
pass_scenarios: pass,
|
|
101
|
-
pass_percentage: total > 0 ? Math.round((pass / total) * 100) : 0,
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
/** Absolute paths of every file directly under `scenarios/intent/`. */
|
|
105
|
-
export async function listIntentFiles(checkoutRoot) {
|
|
106
|
-
const { intentDir } = scenariosPaths(checkoutRoot);
|
|
107
|
-
let entries;
|
|
108
|
-
try {
|
|
109
|
-
entries = await readdir(intentDir);
|
|
110
|
-
}
|
|
111
|
-
catch {
|
|
112
|
-
return [];
|
|
113
|
-
}
|
|
114
|
-
const files = [];
|
|
115
|
-
for (const entry of entries.sort()) {
|
|
116
|
-
const full = path.join(intentDir, entry);
|
|
117
|
-
try {
|
|
118
|
-
if ((await stat(full)).isFile())
|
|
119
|
-
files.push(full);
|
|
120
|
-
}
|
|
121
|
-
catch {
|
|
122
|
-
// Skip unreadable entries.
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
return files;
|
|
126
|
-
}
|
|
127
|
-
const SKIP_BUNDLE_DIRS = new Set([".git", "__pycache__", ".venv", "node_modules"]);
|
|
128
|
-
/** Every file under `scenarios/` except `scores.json`, as relative POSIX paths. */
|
|
129
|
-
export async function listBundleFiles(checkoutRoot) {
|
|
130
|
-
const { dir } = scenariosPaths(checkoutRoot);
|
|
131
|
-
const out = [];
|
|
132
|
-
async function walk(current) {
|
|
133
|
-
let entries;
|
|
134
|
-
try {
|
|
135
|
-
entries = await readdir(current, { withFileTypes: true });
|
|
136
|
-
}
|
|
137
|
-
catch {
|
|
138
|
-
return;
|
|
139
|
-
}
|
|
140
|
-
for (const entry of entries.sort((a, b) => a.name.localeCompare(b.name))) {
|
|
141
|
-
const abs = path.join(current, entry.name);
|
|
142
|
-
if (entry.isDirectory()) {
|
|
143
|
-
if (SKIP_BUNDLE_DIRS.has(entry.name))
|
|
144
|
-
continue;
|
|
145
|
-
await walk(abs);
|
|
146
|
-
continue;
|
|
147
|
-
}
|
|
148
|
-
if (!entry.isFile())
|
|
149
|
-
continue;
|
|
150
|
-
const rel = path.relative(dir, abs).split(path.sep).join("/");
|
|
151
|
-
if (rel === SCORES_FILE)
|
|
152
|
-
continue;
|
|
153
|
-
out.push({ rel, abs });
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
await walk(dir);
|
|
157
|
-
return out;
|
|
158
|
-
}
|
|
159
|
-
// ─── Validation ───
|
|
160
|
-
/**
|
|
161
|
-
* Pre-flight the suite against the server contract so a push fails here
|
|
162
|
-
* with a clear message instead of a remote 422. Returns the scenarios.
|
|
163
|
-
*/
|
|
164
|
-
export function validateScenariosFile(file) {
|
|
165
|
-
const seen = new Set();
|
|
166
|
-
file.scenarios.forEach((row, index) => {
|
|
167
|
-
// Rows come straight from user-edited JSON — the type is aspirational.
|
|
168
|
-
if (typeof row !== "object" || row === null || Array.isArray(row)) {
|
|
169
|
-
throw new ValidationError(`Scenario at index ${String(index)} must be an object.`);
|
|
170
|
-
}
|
|
171
|
-
const scenario = row;
|
|
172
|
-
const code = typeof scenario.code === "string" ? scenario.code.trim() : "";
|
|
173
|
-
if (!code) {
|
|
174
|
-
throw new ValidationError(`Scenario at index ${String(index)} is missing a non-empty "code".`);
|
|
175
|
-
}
|
|
176
|
-
if (seen.has(code)) {
|
|
177
|
-
throw new ValidationError(`Duplicate scenario code "${code}".`);
|
|
178
|
-
}
|
|
179
|
-
seen.add(code);
|
|
180
|
-
});
|
|
181
|
-
return file.scenarios;
|
|
182
|
-
}
|
|
183
|
-
// ─── Context guards ───
|
|
184
|
-
function requireCheckout(context) {
|
|
185
|
-
if (!context.agentRoot) {
|
|
186
|
-
throw new ConfigError("Scenarios live in an agent checkout.", "cd into an agent checkout (or import one) first.");
|
|
187
|
-
}
|
|
188
|
-
return context.agentRoot;
|
|
189
|
-
}
|
|
190
|
-
function requireAgentId(context) {
|
|
191
|
-
if (!context.agentId) {
|
|
192
|
-
throw new ConfigError("No agent bound — scenarios sync is per agent.", "cd into an agent checkout or select an agent first.");
|
|
193
|
-
}
|
|
194
|
-
return context.agentId;
|
|
195
|
-
}
|
|
196
|
-
function requireUserId(context) {
|
|
197
|
-
if (!context.userId) {
|
|
198
|
-
throw new ConfigError("No user id in the session; cannot attribute this push.", "Run `apollo login` to refresh your session.");
|
|
199
|
-
}
|
|
200
|
-
return context.userId;
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Assemble a bundle push from the checkout: the validated suite plus every
|
|
204
|
-
* other file under `scenarios/` except `scores.json`. Throws when the suite
|
|
205
|
-
* is missing/invalid or a file is too large.
|
|
206
|
-
*/
|
|
207
|
-
export async function assembleBundleUpload(checkoutRoot) {
|
|
208
|
-
const suite = await readLocalScenarios(checkoutRoot);
|
|
209
|
-
if (!suite) {
|
|
210
|
-
throw new CliError(`No ${SCENARIOS_DIR}/${SCENARIOS_FILE} found.`, {
|
|
211
|
-
code: "NOT_FOUND",
|
|
212
|
-
suggestion: "Run `apollo scenarios generate` first, then fill in the scenarios.",
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
const scenarios = validateScenariosFile(suite);
|
|
216
|
-
const files = [];
|
|
217
|
-
for (const { rel, abs } of await listBundleFiles(checkoutRoot)) {
|
|
218
|
-
const content = await readFile(abs);
|
|
219
|
-
if (content.length > MAX_FILE_BYTES) {
|
|
220
|
-
throw new ValidationError(`File "${rel}" exceeds the 5 MB limit (${String(content.length)} bytes).`);
|
|
221
|
-
}
|
|
222
|
-
files.push({ path: rel, content });
|
|
223
|
-
}
|
|
224
|
-
return { files, scenariosCount: scenarios.length };
|
|
225
|
-
}
|
|
226
|
-
/** Push the checkout's scenarios tree as a new bundle version. */
|
|
227
|
-
export async function pushScenarioBundle(context, params = {}, options = {}) {
|
|
228
|
-
const root = requireCheckout(context);
|
|
229
|
-
const agentId = requireAgentId(context);
|
|
230
|
-
const createdBy = requireUserId(context);
|
|
231
|
-
const assembled = await assembleBundleUpload(root);
|
|
232
|
-
const response = await clientsFor(context, options).agentSettings.pushBuildBundle(agentId, {
|
|
233
|
-
files: assembled.files,
|
|
234
|
-
createdBy,
|
|
235
|
-
...(params.notes ? { notes: params.notes } : {}),
|
|
236
|
-
});
|
|
237
|
-
const filesCount = response.files_count ?? assembled.files.length;
|
|
238
|
-
return {
|
|
239
|
-
version: response.version,
|
|
240
|
-
scenariosCount: assembled.scenariosCount,
|
|
241
|
-
filesCount,
|
|
242
|
-
intentsCount: Math.max(0, filesCount - (assembled.files.some((f) => f.path === SCENARIOS_FILE) ? 1 : 0)),
|
|
243
|
-
};
|
|
244
|
-
}
|
|
245
|
-
/**
|
|
246
|
-
* Map the on-disk `scores.json` to the `evaluation-scores/push` body.
|
|
247
|
-
* Totals derive from the `scenarios` array when the file doesn't set them.
|
|
248
|
-
*/
|
|
249
|
-
export function scoresToPushBody(scores, ids) {
|
|
250
|
-
const rows = scores.scenarios ?? [];
|
|
251
|
-
const total = scores.total_scenarios ?? rows.length;
|
|
252
|
-
const pass = scores.pass_scenarios ?? rows.filter((row) => row.status === "pass").length;
|
|
253
|
-
const body = {
|
|
254
|
-
version_id: ids.versionId,
|
|
255
|
-
total_scenarios: total,
|
|
256
|
-
pass_scenarios: pass,
|
|
257
|
-
scenarios: rows,
|
|
258
|
-
created_by: ids.createdBy,
|
|
259
|
-
};
|
|
260
|
-
if (ids.versionTag)
|
|
261
|
-
body.version_tag = ids.versionTag;
|
|
262
|
-
if (ids.bundleVersion !== undefined) {
|
|
263
|
-
body.agent_build_bundle_version = ids.bundleVersion;
|
|
264
|
-
}
|
|
265
|
-
if (scores.summary != null)
|
|
266
|
-
body.summary = scores.summary;
|
|
267
|
-
if (scores.residuals != null)
|
|
268
|
-
body.residuals = scores.residuals;
|
|
269
|
-
if (scores.session_ids != null)
|
|
270
|
-
body.session_ids = scores.session_ids;
|
|
271
|
-
for (const key of REPORT_BLOCK_KEYS) {
|
|
272
|
-
const value = scores[key];
|
|
273
|
-
if (value != null)
|
|
274
|
-
body[key] = value;
|
|
275
|
-
}
|
|
276
|
-
return body;
|
|
277
|
-
}
|
|
278
|
-
/** Report blocks in display order (subview + docs share it). */
|
|
279
|
-
export const REPORT_BLOCK_KEYS = [
|
|
280
|
-
"result",
|
|
281
|
-
"ground",
|
|
282
|
-
"skills",
|
|
283
|
-
"depth",
|
|
284
|
-
"speed",
|
|
285
|
-
"grading",
|
|
286
|
-
"custom",
|
|
287
|
-
"weaknesses",
|
|
288
|
-
"ships",
|
|
289
|
-
];
|
|
290
|
-
/**
|
|
291
|
-
* Push the checkout's `scores.json` against the version Talk runs would be
|
|
292
|
-
* graded on: the bound tag, else the live version (`resolveSendVersion`).
|
|
293
|
-
*/
|
|
294
|
-
export async function pushScores(context, params = {}, options = {}) {
|
|
295
|
-
const root = requireCheckout(context);
|
|
296
|
-
const agentId = requireAgentId(context);
|
|
297
|
-
const createdBy = requireUserId(context);
|
|
298
|
-
const scores = await readLocalScores(root);
|
|
299
|
-
if (!scores) {
|
|
300
|
-
throw new CliError(`No ${SCENARIOS_DIR}/${SCORES_FILE} found.`, {
|
|
301
|
-
code: "NOT_FOUND",
|
|
302
|
-
suggestion: "Run the scoring skill first, or push with --skip-scores.",
|
|
303
|
-
});
|
|
304
|
-
}
|
|
305
|
-
const clients = clientsFor(context, options);
|
|
306
|
-
const versionId = await resolveSendVersion(context, clients.management);
|
|
307
|
-
if (!versionId) {
|
|
308
|
-
throw new ConfigError("Could not resolve the agent version to score.");
|
|
309
|
-
}
|
|
310
|
-
const body = scoresToPushBody(scores, {
|
|
311
|
-
versionId,
|
|
312
|
-
createdBy,
|
|
313
|
-
...(params.bundleVersion === undefined
|
|
314
|
-
? {}
|
|
315
|
-
: { bundleVersion: params.bundleVersion }),
|
|
316
|
-
});
|
|
317
|
-
const response = await clients.agentSettings.pushEvaluationScore(agentId, body);
|
|
318
|
-
return {
|
|
319
|
-
total: response.total_scenarios,
|
|
320
|
-
pass: response.pass_scenarios,
|
|
321
|
-
versionTag: response.version_tag,
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
function safeBundleRel(rel) {
|
|
325
|
-
const normalized = rel.replaceAll("\\", "/").replace(/^\/+/, "");
|
|
326
|
-
if (!normalized || normalized.split("/").includes(".."))
|
|
327
|
-
return undefined;
|
|
328
|
-
return normalized;
|
|
329
|
-
}
|
|
330
|
-
async function downloadBundleFile(dest, signedUrl, label, fetchImpl) {
|
|
331
|
-
const download = await fetchImpl(signedUrl);
|
|
332
|
-
if (!download.ok) {
|
|
333
|
-
throw new CliError(`Failed to download "${label}": ${String(download.status)} ${download.statusText}`);
|
|
334
|
-
}
|
|
335
|
-
await mkdir(path.dirname(dest), { recursive: true });
|
|
336
|
-
await writeFile(dest, Buffer.from(await download.arrayBuffer()));
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Pull the latest (or a specific) bundle into `scenarios/`: downloads every
|
|
340
|
-
* file via its signed URL. `found: false` (no throw) when the agent has no
|
|
341
|
-
* bundle yet.
|
|
342
|
-
*/
|
|
343
|
-
export async function pullScenarios(context, params = {}, options = {}) {
|
|
344
|
-
const root = requireCheckout(context);
|
|
345
|
-
const agentId = requireAgentId(context);
|
|
346
|
-
let response;
|
|
347
|
-
try {
|
|
348
|
-
response = await clientsFor(context, options).agentSettings.pullBuildBundle(agentId, {
|
|
349
|
-
...(params.bundleVersion === undefined
|
|
350
|
-
? {}
|
|
351
|
-
: { version: params.bundleVersion }),
|
|
352
|
-
expiresIn: 15,
|
|
353
|
-
});
|
|
354
|
-
}
|
|
355
|
-
catch (error) {
|
|
356
|
-
if (error instanceof ApiError && error.status === 404) {
|
|
357
|
-
return { found: false };
|
|
358
|
-
}
|
|
359
|
-
throw error;
|
|
360
|
-
}
|
|
361
|
-
const { bundle } = response;
|
|
362
|
-
const { dir } = scenariosPaths(root);
|
|
363
|
-
const fetchImpl = fetchFor(options);
|
|
364
|
-
let filesCount = 0;
|
|
365
|
-
for (const [rel, signedUrl] of Object.entries(response.file_urls ?? {})) {
|
|
366
|
-
const safeRel = safeBundleRel(rel);
|
|
367
|
-
if (!safeRel || typeof signedUrl !== "string" || !signedUrl)
|
|
368
|
-
continue;
|
|
369
|
-
await downloadBundleFile(path.join(dir, ...safeRel.split("/")), signedUrl, safeRel, fetchImpl);
|
|
370
|
-
filesCount += 1;
|
|
371
|
-
}
|
|
372
|
-
const suite = await readLocalScenarios(root);
|
|
373
|
-
const scenariosCount = suite?.scenarios.length ?? 0;
|
|
374
|
-
return {
|
|
375
|
-
found: true,
|
|
376
|
-
version: bundle.version,
|
|
377
|
-
scenariosCount,
|
|
378
|
-
filesCount,
|
|
379
|
-
intentsCount: Math.max(0, filesCount - (suite ? 1 : 0)),
|
|
380
|
-
};
|
|
381
|
-
}
|
|
382
|
-
/**
|
|
383
|
-
* Pull the newest score for the version Talk runs against (bound tag, else
|
|
384
|
-
* live) and write it to `scenarios/scores.json`. `found: false` when the
|
|
385
|
-
* version has no scores yet (empty array — not an error).
|
|
386
|
-
*/
|
|
387
|
-
export async function pullScores(context, options = {}) {
|
|
388
|
-
const root = requireCheckout(context);
|
|
389
|
-
const agentId = requireAgentId(context);
|
|
390
|
-
const clients = clientsFor(context, options);
|
|
391
|
-
const versionId = await resolveSendVersion(context, clients.management);
|
|
392
|
-
if (!versionId)
|
|
393
|
-
return { found: false };
|
|
394
|
-
const scores = await clients.agentSettings.pullEvaluationScores(agentId, {
|
|
395
|
-
versionId,
|
|
396
|
-
});
|
|
397
|
-
const latest = scores[0];
|
|
398
|
-
if (!latest)
|
|
399
|
-
return { found: false };
|
|
400
|
-
const local = {
|
|
401
|
-
summary: latest.summary ?? null,
|
|
402
|
-
total_scenarios: latest.total_scenarios,
|
|
403
|
-
pass_scenarios: latest.pass_scenarios,
|
|
404
|
-
residuals: latest.residuals ?? null,
|
|
405
|
-
scenarios: latest.scenarios,
|
|
406
|
-
session_ids: latest.session_ids ?? [],
|
|
407
|
-
};
|
|
408
|
-
for (const key of REPORT_BLOCK_KEYS) {
|
|
409
|
-
local[key] = latest[key] ?? null;
|
|
410
|
-
}
|
|
411
|
-
await writeLocalScores(root, local);
|
|
412
|
-
return {
|
|
413
|
-
found: true,
|
|
414
|
-
total: latest.total_scenarios,
|
|
415
|
-
pass: latest.pass_scenarios,
|
|
416
|
-
versionTag: latest.version_tag,
|
|
417
|
-
};
|
|
418
|
-
}
|
|
419
|
-
/**
|
|
420
|
-
* Best-effort scenarios pull for `agent import`. NEVER throws — scenarios
|
|
421
|
-
* are supplementary, exactly like skills and schemas, so a failure here
|
|
422
|
-
* must not break the import.
|
|
423
|
-
*/
|
|
424
|
-
export async function syncScenarios(context, options = {}) {
|
|
425
|
-
try {
|
|
426
|
-
const bundle = await pullScenarios(context, {}, options);
|
|
427
|
-
if (!bundle.found)
|
|
428
|
-
return { found: false };
|
|
429
|
-
let scoresFound = false;
|
|
430
|
-
try {
|
|
431
|
-
scoresFound = (await pullScores(context, options)).found;
|
|
432
|
-
}
|
|
433
|
-
catch {
|
|
434
|
-
// Scores are best-effort even inside the best-effort sync.
|
|
435
|
-
}
|
|
436
|
-
return {
|
|
437
|
-
found: true,
|
|
438
|
-
...(bundle.version === undefined ? {} : { version: bundle.version }),
|
|
439
|
-
...(bundle.scenariosCount === undefined
|
|
440
|
-
? {}
|
|
441
|
-
: { scenariosCount: bundle.scenariosCount }),
|
|
442
|
-
...(bundle.filesCount === undefined ? {} : { filesCount: bundle.filesCount }),
|
|
443
|
-
...(bundle.intentsCount === undefined
|
|
444
|
-
? {}
|
|
445
|
-
: { intentsCount: bundle.intentsCount }),
|
|
446
|
-
scoresFound,
|
|
447
|
-
};
|
|
448
|
-
}
|
|
449
|
-
catch (error) {
|
|
450
|
-
return {
|
|
451
|
-
found: false,
|
|
452
|
-
error: error instanceof Error ? error.message : String(error),
|
|
453
|
-
};
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
/**
|
|
457
|
-
* Scaffold `scenarios/` for a fresh start: `intent/` plus a skeleton suite
|
|
458
|
-
* — only when missing, never clobbering existing work.
|
|
459
|
-
*/
|
|
460
|
-
export async function scaffoldScenarios(checkoutRoot) {
|
|
461
|
-
const { dir, intentDir, scenariosFile } = scenariosPaths(checkoutRoot);
|
|
462
|
-
await mkdir(dir, { recursive: true });
|
|
463
|
-
let createdIntentDir = false;
|
|
464
|
-
try {
|
|
465
|
-
await stat(intentDir);
|
|
466
|
-
}
|
|
467
|
-
catch {
|
|
468
|
-
await mkdir(intentDir, { recursive: true });
|
|
469
|
-
createdIntentDir = true;
|
|
470
|
-
}
|
|
471
|
-
let createdScenariosFile = false;
|
|
472
|
-
try {
|
|
473
|
-
await stat(scenariosFile);
|
|
474
|
-
}
|
|
475
|
-
catch {
|
|
476
|
-
await writeJson(scenariosFile, { scenarios: [] });
|
|
477
|
-
createdScenariosFile = true;
|
|
478
|
-
}
|
|
479
|
-
return { createdScenariosFile, createdIntentDir };
|
|
480
|
-
}
|
|
481
|
-
//# sourceMappingURL=scenarios.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"scenarios.js","sourceRoot":"","sources":["../../../src/services/scenarios.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,IAAI,MAAM,WAAW,CAAC;AAW7B,OAAO,EACL,QAAQ,EACR,QAAQ,EACR,WAAW,EACX,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,aAAa,EAAgB,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAEpD,iBAAi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Y,EAAE,MAAM,CAAC,YAAY,EAAE,CAAC;YAC1C,WAAW;SACZ,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,KAAK,EAAE,KAAK;YACZ,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;SAC9D,CAAC;IACJ,CAAC;AACH,CAAC;AASD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,YAAoB;IAEpB,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,cAAc,CAAC,YAAY,CAAC,CAAC;IACvE,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACtC,IAAI,gBAAgB,GAAG,KAAK,CAAC;IAC7B,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC;IACxB,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,KAAK,CAAC,SAAS,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5C,gBAAgB,GAAG,IAAI,CAAC;IAC1B,CAAC;IACD,IAAI,oBAAoB,GAAG,KAAK,CAAC;IACjC,IAAI,CAAC;QACH,MAAM,IAAI,CAAC,aAAa,CAAC,CAAC;IAC5B,CAAC;IAAC,MAAM,CAAC;QACP,MAAM,SAAS,CAAC,aAAa,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC;QAClD,oBAAoB,GAAG,IAAI,CAAC;IAC9B,CAAC;IACD,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,CAAC;AACpD,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { type RefObject } from "react";
|
|
2
|
-
import type { ScrollBoxRenderable } from "@opentui/core";
|
|
3
|
-
import type { ScenarioViewRow } from "./scenarios.js";
|
|
4
|
-
/**
|
|
5
|
-
* Scenarios subview — the evaluation suite as a list (status glyph,
|
|
6
|
-
* pass@k, goal) with a report pane (markdown blocks). Same shell as the
|
|
7
|
-
* resources subview: sidebar list + detail pane, Enter expands the detail
|
|
8
|
-
* full-width, Esc collapses, the wheel scrolls, clicks select/activate.
|
|
9
|
-
* `t` jumps to the selected row's graded transcript in Talk.
|
|
10
|
-
*/
|
|
11
|
-
export declare function ScenariosView({ rows, cursor, expanded, sidebarWidth, pageSize, scrollRef, loadedNote, onRowClick, }: {
|
|
12
|
-
rows: ScenarioViewRow[];
|
|
13
|
-
cursor: number;
|
|
14
|
-
/** Full-width detail (Enter on a row); the list hides until Esc. */
|
|
15
|
-
expanded: boolean;
|
|
16
|
-
sidebarWidth: number;
|
|
17
|
-
pageSize: number;
|
|
18
|
-
scrollRef: RefObject<ScrollBoxRenderable | null>;
|
|
19
|
-
/** "loaded 12s ago · r reload" style note. */
|
|
20
|
-
loadedNote: string;
|
|
21
|
-
onRowClick?: ((index: number) => void) | undefined;
|
|
22
|
-
}): import("react").ReactNode;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "@opentui/react/jsx-runtime";
|
|
2
|
-
import { memo, useEffect } from "react";
|
|
3
|
-
import { G } from "../theme/glyphs.js";
|
|
4
|
-
import { getSyntaxStyle, getTreeSitter } from "../theme/syntax.js";
|
|
5
|
-
import { AMBER, DIM, FAINT, FG, RICH, TEAL, TEAL_DIM, } from "../theme/tokens.js";
|
|
6
|
-
/**
|
|
7
|
-
* Scenarios subview — the evaluation suite as a list (status glyph,
|
|
8
|
-
* pass@k, goal) with a report pane (markdown blocks). Same shell as the
|
|
9
|
-
* resources subview: sidebar list + detail pane, Enter expands the detail
|
|
10
|
-
* full-width, Esc collapses, the wheel scrolls, clicks select/activate.
|
|
11
|
-
* `t` jumps to the selected row's graded transcript in Talk.
|
|
12
|
-
*/
|
|
13
|
-
export function ScenariosView({ rows, cursor, expanded, sidebarWidth, pageSize, scrollRef, loadedNote, onRowClick, }) {
|
|
14
|
-
const selected = rows[cursor];
|
|
15
|
-
if (expanded) {
|
|
16
|
-
return (_jsx(DetailPane, { row: selected, loadedNote: loadedNote, scrollRef: scrollRef }));
|
|
17
|
-
}
|
|
18
|
-
return (_jsxs("box", { style: { flexDirection: "row", flexGrow: 1, minHeight: 0, width: "100%" }, children: [_jsx("box", { style: {
|
|
19
|
-
width: sidebarWidth,
|
|
20
|
-
flexShrink: 0,
|
|
21
|
-
minHeight: 0,
|
|
22
|
-
flexDirection: "column",
|
|
23
|
-
}, children: _jsx(ListPane, { rows: rows, cursor: cursor, pageSize: pageSize, onRowClick: onRowClick }) }), _jsx(DetailPane, { row: selected, loadedNote: loadedNote, scrollRef: scrollRef })] }));
|
|
24
|
-
}
|
|
25
|
-
function statusGlyph(row) {
|
|
26
|
-
if (row.kind === "summary")
|
|
27
|
-
return { glyph: G.bullet, color: row.warn ? AMBER : TEAL };
|
|
28
|
-
if (row.kind === "action")
|
|
29
|
-
return { glyph: "+", color: TEAL_DIM };
|
|
30
|
-
if (row.kind === "note")
|
|
31
|
-
return { glyph: G.warn, color: row.warn ? AMBER : FAINT };
|
|
32
|
-
if (row.status === "pass")
|
|
33
|
-
return { glyph: G.ok, color: TEAL };
|
|
34
|
-
if (row.status === "open")
|
|
35
|
-
return { glyph: G.fail, color: AMBER };
|
|
36
|
-
return { glyph: "·", color: FAINT };
|
|
37
|
-
}
|
|
38
|
-
function rowColor(row, active) {
|
|
39
|
-
if (row.kind === "action")
|
|
40
|
-
return active ? FG : TEAL_DIM;
|
|
41
|
-
if (row.kind === "note")
|
|
42
|
-
return row.warn ? AMBER : DIM;
|
|
43
|
-
return active ? FG : DIM;
|
|
44
|
-
}
|
|
45
|
-
const ListPane = memo(function ListPane({ rows, cursor, pageSize, onRowClick, }) {
|
|
46
|
-
const start = rows.length <= pageSize
|
|
47
|
-
? 0
|
|
48
|
-
: Math.max(0, Math.min(cursor - Math.floor(pageSize / 3), rows.length - pageSize));
|
|
49
|
-
const window = rows.slice(start, start + pageSize);
|
|
50
|
-
return (_jsxs("box", { title: " scenarios ", style: {
|
|
51
|
-
border: true,
|
|
52
|
-
borderStyle: "rounded",
|
|
53
|
-
borderColor: TEAL_DIM,
|
|
54
|
-
flexDirection: "column",
|
|
55
|
-
flexGrow: 1,
|
|
56
|
-
minHeight: 0,
|
|
57
|
-
overflow: "hidden",
|
|
58
|
-
paddingLeft: 1,
|
|
59
|
-
paddingRight: 1,
|
|
60
|
-
}, children: [start > 0 ? _jsxs("text", { fg: FAINT, children: ["\u2026 ", start, " above"] }) : null, window.map((row, i) => {
|
|
61
|
-
const index = start + i;
|
|
62
|
-
const active = index === cursor;
|
|
63
|
-
const status = statusGlyph(row);
|
|
64
|
-
return (_jsxs("text", { fg: rowColor(row, active), onMouseDown: onRowClick
|
|
65
|
-
? () => {
|
|
66
|
-
onRowClick(index);
|
|
67
|
-
}
|
|
68
|
-
: undefined, children: [active ? `${G.pointerBold} ` : " ", _jsxs("span", { fg: status.color, children: [status.glyph, " "] }), row.label, row.note ? (_jsx("span", { fg: row.warn ? AMBER : FAINT, children: ` ${row.note}` })) : null] }, row.id));
|
|
69
|
-
}), start + window.length < rows.length ? (_jsxs("text", { fg: FAINT, children: ["\u2026 ", rows.length - start - window.length, " below"] })) : null] }));
|
|
70
|
-
});
|
|
71
|
-
function Block({ block }) {
|
|
72
|
-
return (_jsxs("box", { style: { flexDirection: "column", width: "100%", flexShrink: 0 }, children: [block.heading ? (_jsx("text", { fg: TEAL, style: { flexShrink: 0 }, children: block.heading.toUpperCase() })) : null, block.markdown && RICH ? (_jsx("markdown", { content: block.text, syntaxStyle: getSyntaxStyle(), treeSitterClient: getTreeSitter(), style: { width: "100%" } })) : (_jsx("text", { fg: FG, wrapMode: "word", children: block.text })), _jsx("text", { children: " " })] }));
|
|
73
|
-
}
|
|
74
|
-
const DetailPane = memo(function DetailPane({ row, loadedNote, scrollRef, }) {
|
|
75
|
-
// Same scrollbox across selection moves — just rewind.
|
|
76
|
-
useEffect(() => {
|
|
77
|
-
scrollRef.current?.scrollTo({ x: 0, y: 0 });
|
|
78
|
-
}, [row?.id, scrollRef]);
|
|
79
|
-
const hasTranscript = (row?.sessionIds.length ?? 0) > 0;
|
|
80
|
-
return (_jsxs("box", { title: ` ${row?.detailTitle ?? "scenarios"} `, style: {
|
|
81
|
-
border: true,
|
|
82
|
-
borderStyle: "rounded",
|
|
83
|
-
borderColor: TEAL_DIM,
|
|
84
|
-
flexDirection: "column",
|
|
85
|
-
flexGrow: 1,
|
|
86
|
-
flexBasis: 0,
|
|
87
|
-
minHeight: 0,
|
|
88
|
-
paddingLeft: 1,
|
|
89
|
-
paddingRight: 1,
|
|
90
|
-
}, children: [_jsxs("text", { fg: DIM, style: { flexShrink: 0 }, children: [loadedNote, hasTranscript ? (_jsx("span", { fg: FAINT, children: " \u00B7 t opens the graded transcript" })) : null] }), !row || row.blocks.length === 0 ? (_jsx("text", { fg: FAINT, children: row?.kind === "action"
|
|
91
|
-
? "Enter runs this action"
|
|
92
|
-
: "(select a row — its report renders here)" })) : (_jsx("scrollbox", { ref: scrollRef, style: {
|
|
93
|
-
flexGrow: 1,
|
|
94
|
-
flexShrink: 1,
|
|
95
|
-
flexBasis: 0,
|
|
96
|
-
flexDirection: "column",
|
|
97
|
-
}, children: row.blocks.map((block, index) => (_jsx(Block, { block: block }, `${row.id}/${String(index)}`))) }))] }));
|
|
98
|
-
});
|
|
99
|
-
//# sourceMappingURL=ScenariosView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ScenariosView.js","sourceRoot":"","sources":["../../../src/author/ScenariosView.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,SAAS,EAAkB,MAAM,OAAO,CAAC;AAIxD,OAAO,EAAE,CAAC,EAAE,MAAM,oBAAoB,CAAC;AACvC,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,oBAAoB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