@aui.io/apollo 0.1.16 → 0.1.18
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 +35 -2
- 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/hierarchy.js +12 -3
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/mockdb.js +3 -2
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/mockdb.js.map +1 -1
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.d.ts +3 -0
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.js +124 -0
- package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.js.map +1 -0
- package/node_modules/@aui.io/apollo-cli/dist/src/index.js +2 -0
- 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 +177 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js +67 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/client-types.d.ts +5 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/management.d.ts +9 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/management.js +14 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/management.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.d.ts +7 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js +8 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/runtime-api.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/api/transport.d.ts +27 -0
- package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js +39 -9
- package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/index.js +7 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/index.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +7 -0
- package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +5 -3
- package/node_modules/@aui.io/apollo-core/dist/src/index.js +5 -3
- 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 +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/bundles.js +4 -1
- 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/clients.d.ts +3 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +11 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.d.ts +26 -2
- package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js +44 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/hierarchy.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.d.ts +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js +12 -3
- package/node_modules/@aui.io/apollo-core/dist/src/services/messaging.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.d.ts +11 -2
- package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.js +35 -4
- package/node_modules/@aui.io/apollo-core/dist/src/services/mockdb.js.map +1 -1
- package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.d.ts +151 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.js +459 -0
- package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.js.map +1 -0
- package/node_modules/@aui.io/apollo-core/package.json +1 -1
- package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js +37 -0
- 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 +3 -0
- 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 +3 -1
- 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/author/ScenariosView.d.ts +22 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/author/ScenariosView.js +99 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/author/ScenariosView.js.map +1 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.d.ts +47 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.js +284 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.js.map +1 -0
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.d.ts +4 -3
- package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +118 -8
- 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.js +52 -1
- 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 +159 -15
- 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 +1 -0
- 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
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scenarios subview data layer — the checkout's evaluation suite
|
|
3
|
+
* (`scenarios/scenarios.json`) merged with its last score
|
|
4
|
+
* (`scenarios/scores.json`) into one navigable row list plus detail
|
|
5
|
+
* blocks per row. Local-first and pure fs: remote sync stays with the
|
|
6
|
+
* `scenarios-pull` / `scenarios-push` / `scores-pull` commands, so the
|
|
7
|
+
* view itself works offline and re-reads instantly after a pull.
|
|
8
|
+
*/
|
|
9
|
+
import { readLocalScenarios, readLocalScores, REPORT_BLOCK_KEYS, } from "@aui.io/apollo-core/services/scenarios.js";
|
|
10
|
+
/** Read both files; a broken one degrades to an error row, never a crash. */
|
|
11
|
+
export async function loadScenariosData(checkoutRoot) {
|
|
12
|
+
try {
|
|
13
|
+
const [suite, scores] = await Promise.all([
|
|
14
|
+
readLocalScenarios(checkoutRoot),
|
|
15
|
+
readLocalScores(checkoutRoot),
|
|
16
|
+
]);
|
|
17
|
+
return {
|
|
18
|
+
loadedAt: Date.now(),
|
|
19
|
+
suite: suite?.scenarios,
|
|
20
|
+
scores,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
catch (error) {
|
|
24
|
+
return {
|
|
25
|
+
loadedAt: Date.now(),
|
|
26
|
+
error: error instanceof Error ? error.message : String(error),
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function totalsOf(scores) {
|
|
31
|
+
const rows = scores.scenarios ?? [];
|
|
32
|
+
const total = scores.total_scenarios ?? rows.length;
|
|
33
|
+
const pass = scores.pass_scenarios ?? rows.filter((row) => row.status === "pass").length;
|
|
34
|
+
return {
|
|
35
|
+
total,
|
|
36
|
+
pass,
|
|
37
|
+
pct: scores.pass_percentage ??
|
|
38
|
+
(total > 0 ? Math.round((pass / total) * 100) : 0),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function attemptsOf(result) {
|
|
42
|
+
if (result?.k === undefined)
|
|
43
|
+
return "";
|
|
44
|
+
return `${String(result.passed ?? 0)}/${String(result.k)}`;
|
|
45
|
+
}
|
|
46
|
+
function clip(text, max) {
|
|
47
|
+
const oneLine = text.replaceAll(/\s+/g, " ").trim();
|
|
48
|
+
return oneLine.length <= max ? oneLine : `${oneLine.slice(0, max - 1)}…`;
|
|
49
|
+
}
|
|
50
|
+
function summaryBlocks(scores) {
|
|
51
|
+
const blocks = [];
|
|
52
|
+
if (scores.summary) {
|
|
53
|
+
blocks.push({ text: scores.summary, markdown: true });
|
|
54
|
+
}
|
|
55
|
+
if (scores.residuals) {
|
|
56
|
+
blocks.push({ heading: "residuals", text: scores.residuals, markdown: true });
|
|
57
|
+
}
|
|
58
|
+
for (const key of REPORT_BLOCK_KEYS) {
|
|
59
|
+
const text = scores[key];
|
|
60
|
+
if (typeof text === "string" && text.trim()) {
|
|
61
|
+
blocks.push({ heading: key, text, markdown: true });
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
if (scores.session_ids && scores.session_ids.length > 0) {
|
|
65
|
+
blocks.push({
|
|
66
|
+
heading: "run transcripts",
|
|
67
|
+
text: scores.session_ids.join("\n"),
|
|
68
|
+
markdown: false,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (blocks.length === 0) {
|
|
72
|
+
blocks.push({ text: "No report attached to this score.", markdown: false });
|
|
73
|
+
}
|
|
74
|
+
return blocks;
|
|
75
|
+
}
|
|
76
|
+
function scenarioBlocks(scenario, result) {
|
|
77
|
+
const blocks = [];
|
|
78
|
+
const goal = typeof scenario?.goal === "string" ? scenario.goal : "";
|
|
79
|
+
const description = typeof scenario?.description === "string" ? scenario.description : "";
|
|
80
|
+
if (goal)
|
|
81
|
+
blocks.push({ heading: "goal", text: goal, markdown: true });
|
|
82
|
+
if (description) {
|
|
83
|
+
blocks.push({ heading: "description", text: description, markdown: true });
|
|
84
|
+
}
|
|
85
|
+
// Extra suite keys (beyond code/goal/description) stay visible — the
|
|
86
|
+
// server preserves them verbatim, so authors do use them.
|
|
87
|
+
const extras = Object.entries(scenario ?? {}).filter(([key, value]) => key !== "code" &&
|
|
88
|
+
key !== "goal" &&
|
|
89
|
+
key !== "description" &&
|
|
90
|
+
value != null);
|
|
91
|
+
if (extras.length > 0) {
|
|
92
|
+
blocks.push({
|
|
93
|
+
heading: "extra",
|
|
94
|
+
text: extras
|
|
95
|
+
.map(([key, value]) => `${key}: ${typeof value === "string" ? value : JSON.stringify(value)}`)
|
|
96
|
+
.join("\n"),
|
|
97
|
+
markdown: false,
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
if (result) {
|
|
101
|
+
const attempts = attemptsOf(result);
|
|
102
|
+
blocks.push({
|
|
103
|
+
heading: "result",
|
|
104
|
+
text: `${result.status}${attempts ? ` · ${attempts} attempts passed` : ""}`,
|
|
105
|
+
markdown: false,
|
|
106
|
+
});
|
|
107
|
+
if (result.comments) {
|
|
108
|
+
blocks.push({ heading: "comments", text: result.comments, markdown: true });
|
|
109
|
+
}
|
|
110
|
+
if (result.session_ids && result.session_ids.length > 0) {
|
|
111
|
+
blocks.push({
|
|
112
|
+
heading: "transcripts",
|
|
113
|
+
text: result.session_ids.join("\n"),
|
|
114
|
+
markdown: false,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
else {
|
|
119
|
+
blocks.push({
|
|
120
|
+
text: "Not scored yet — the scoring skill writes scores.json.",
|
|
121
|
+
markdown: false,
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
return blocks;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Flatten suite + scores into rows: the score summary first, then every
|
|
128
|
+
* scenario (suite order, score-only codes appended), then action rows.
|
|
129
|
+
*/
|
|
130
|
+
export function scenarioRows(data) {
|
|
131
|
+
if (!data) {
|
|
132
|
+
return [
|
|
133
|
+
{
|
|
134
|
+
id: "loading",
|
|
135
|
+
kind: "note",
|
|
136
|
+
label: "loading scenarios…",
|
|
137
|
+
sessionIds: [],
|
|
138
|
+
detailTitle: "scenarios",
|
|
139
|
+
blocks: [],
|
|
140
|
+
},
|
|
141
|
+
];
|
|
142
|
+
}
|
|
143
|
+
if (data.error) {
|
|
144
|
+
return [
|
|
145
|
+
{
|
|
146
|
+
id: "error",
|
|
147
|
+
kind: "note",
|
|
148
|
+
label: data.error,
|
|
149
|
+
warn: true,
|
|
150
|
+
sessionIds: [],
|
|
151
|
+
detailTitle: "scenarios",
|
|
152
|
+
blocks: [
|
|
153
|
+
{ text: data.error, markdown: false },
|
|
154
|
+
{
|
|
155
|
+
text: "Fix the JSON in scenarios/ (or re-pull) and press r.",
|
|
156
|
+
markdown: false,
|
|
157
|
+
},
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
];
|
|
161
|
+
}
|
|
162
|
+
const rows = [];
|
|
163
|
+
const suite = data.suite ?? [];
|
|
164
|
+
const results = new Map((data.scores?.scenarios ?? []).map((row) => [row.scenario_code, row]));
|
|
165
|
+
if (data.scores) {
|
|
166
|
+
const totals = totalsOf(data.scores);
|
|
167
|
+
rows.push({
|
|
168
|
+
id: "summary",
|
|
169
|
+
kind: "summary",
|
|
170
|
+
label: "last score",
|
|
171
|
+
note: `${String(totals.pass)}/${String(totals.total)} pass (${String(totals.pct)}%)`,
|
|
172
|
+
sessionIds: data.scores.session_ids ?? [],
|
|
173
|
+
detailTitle: "last score",
|
|
174
|
+
blocks: summaryBlocks(data.scores),
|
|
175
|
+
...(totals.pass < totals.total ? { warn: true } : {}),
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
for (const scenario of suite) {
|
|
179
|
+
const result = results.get(scenario.code);
|
|
180
|
+
const attempts = attemptsOf(result);
|
|
181
|
+
const goal = typeof scenario.goal === "string" ? scenario.goal : "";
|
|
182
|
+
rows.push({
|
|
183
|
+
id: `s/${scenario.code}`,
|
|
184
|
+
kind: "scenario",
|
|
185
|
+
label: scenario.code,
|
|
186
|
+
note: [attempts, goal ? clip(goal, 48) : ""]
|
|
187
|
+
.filter(Boolean)
|
|
188
|
+
.join(" · ") || undefined,
|
|
189
|
+
status: result?.status,
|
|
190
|
+
sessionIds: result?.session_ids ?? [],
|
|
191
|
+
detailTitle: scenario.code,
|
|
192
|
+
blocks: scenarioBlocks(scenario, result),
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
// Scored codes missing from the local suite still render — a stale suite
|
|
196
|
+
// must not hide grades.
|
|
197
|
+
for (const [code, result] of results) {
|
|
198
|
+
if (suite.some((scenario) => scenario.code === code))
|
|
199
|
+
continue;
|
|
200
|
+
rows.push({
|
|
201
|
+
id: `s/${code}`,
|
|
202
|
+
kind: "scenario",
|
|
203
|
+
label: code,
|
|
204
|
+
note: "not in the local suite",
|
|
205
|
+
status: result.status,
|
|
206
|
+
sessionIds: result.session_ids ?? [],
|
|
207
|
+
detailTitle: code,
|
|
208
|
+
blocks: scenarioBlocks(undefined, result),
|
|
209
|
+
warn: true,
|
|
210
|
+
});
|
|
211
|
+
}
|
|
212
|
+
if (suite.length === 0 && !data.scores) {
|
|
213
|
+
rows.push({
|
|
214
|
+
id: "empty",
|
|
215
|
+
kind: "note",
|
|
216
|
+
label: "no scenarios yet",
|
|
217
|
+
note: "pull the suite, or scaffold a new one",
|
|
218
|
+
sessionIds: [],
|
|
219
|
+
detailTitle: "scenarios",
|
|
220
|
+
blocks: [
|
|
221
|
+
{
|
|
222
|
+
text: "No scenarios/ files in this checkout. Pull the agent's suite, or scaffold an empty one and let a copilot fill it in.",
|
|
223
|
+
markdown: false,
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
rows.push({
|
|
229
|
+
id: "action/pull",
|
|
230
|
+
kind: "action",
|
|
231
|
+
label: "pull latest from remote",
|
|
232
|
+
note: "suite + intent files",
|
|
233
|
+
command: "scenarios-pull",
|
|
234
|
+
sessionIds: [],
|
|
235
|
+
detailTitle: "scenarios",
|
|
236
|
+
blocks: [],
|
|
237
|
+
}, {
|
|
238
|
+
id: "action/scores",
|
|
239
|
+
kind: "action",
|
|
240
|
+
label: "pull newest score",
|
|
241
|
+
note: "for the bound version",
|
|
242
|
+
command: "scores-pull",
|
|
243
|
+
sessionIds: [],
|
|
244
|
+
detailTitle: "scenarios",
|
|
245
|
+
blocks: [],
|
|
246
|
+
}, suite.length > 0 || data.scores
|
|
247
|
+
? {
|
|
248
|
+
id: "action/push",
|
|
249
|
+
kind: "action",
|
|
250
|
+
label: "push suite + scores",
|
|
251
|
+
note: "new bundle version",
|
|
252
|
+
command: "scenarios-push",
|
|
253
|
+
sessionIds: [],
|
|
254
|
+
detailTitle: "scenarios",
|
|
255
|
+
blocks: [],
|
|
256
|
+
}
|
|
257
|
+
: {
|
|
258
|
+
id: "action/generate",
|
|
259
|
+
kind: "action",
|
|
260
|
+
label: "scaffold scenarios/",
|
|
261
|
+
note: "suite skeleton + intent/",
|
|
262
|
+
command: "scenarios-generate",
|
|
263
|
+
sessionIds: [],
|
|
264
|
+
detailTitle: "scenarios",
|
|
265
|
+
blocks: [],
|
|
266
|
+
});
|
|
267
|
+
return rows;
|
|
268
|
+
}
|
|
269
|
+
/** One-line summary for the Author home card. */
|
|
270
|
+
export function scenariosSummary(data) {
|
|
271
|
+
if (!data)
|
|
272
|
+
return "s to inspect";
|
|
273
|
+
if (data.error)
|
|
274
|
+
return "unreadable — s to inspect";
|
|
275
|
+
if (data.scores) {
|
|
276
|
+
const totals = totalsOf(data.scores);
|
|
277
|
+
return `${String(totals.pass)}/${String(totals.total)} pass (${String(totals.pct)}%)`;
|
|
278
|
+
}
|
|
279
|
+
if (data.suite && data.suite.length > 0) {
|
|
280
|
+
return `${String(data.suite.length)} scenario(s) · unscored`;
|
|
281
|
+
}
|
|
282
|
+
return "none — s to start";
|
|
283
|
+
}
|
|
284
|
+
//# sourceMappingURL=scenarios.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scenarios.js","sourceRoot":"","sources":["../../../src/author/scenarios.ts"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,IAAI,CAAC,KAAK;QAAE,OAAO,2BAA2B,CAAC;IACnD,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,MAAM,MAAM,GAAG,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC;IACxF,CAAC;IACD,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACxC,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,yBAAyB,CAAC;IAC/D,CAAC;IACD,OAAO,mBAAmB,CAAC;AAC7B,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Agent, type AgentVersion } from "@aui.io/apollo-core/api/management.js";
|
|
2
2
|
import { type Context } from "@aui.io/apollo-core/config/index.js";
|
|
3
3
|
import type { CommandField } from "./commands.js";
|
|
4
4
|
import type { PickerItem } from "./picker.js";
|
|
@@ -54,8 +54,9 @@ export declare const IMPORT_LIVE_PREFIX = "live \u2014 ";
|
|
|
54
54
|
/**
|
|
55
55
|
* Version rows for the import picker: the live version first (row 0 = the
|
|
56
56
|
* picker default) when one exists, else just the tags — the caller shows
|
|
57
|
-
* the "no live version" notice. `live_version_id`
|
|
58
|
-
*
|
|
57
|
+
* the "no live version" notice. `live_version_id` matching (id or tag —
|
|
58
|
+
* both shapes exist in the wild) lives in core's findLiveVersion, shared
|
|
59
|
+
* with CLI import and sends.
|
|
59
60
|
*/
|
|
60
61
|
export declare function importVersionRows(agent: Pick<Agent, "live_version_id">, versions: AgentVersion[]): PickerItem[];
|
|
61
62
|
export declare function loadPickerCatalog(kind: NonNullable<CommandField["picker"]>, context: Context): Promise<PickerItem[]>;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
5
5
|
import { homedir } from "node:os";
|
|
6
6
|
import path from "node:path";
|
|
7
|
+
import { findLiveVersion, } from "@aui.io/apollo-core/api/management.js";
|
|
7
8
|
import { defaultCheckoutDir, forgetCheckout, listCheckouts, registerCheckout, } from "@aui.io/apollo-core/checkouts/registry.js";
|
|
8
9
|
import { readBinding, readCredentials, resolveContext, setDefaultProject, writeCredentials, } from "@aui.io/apollo-core/config/index.js";
|
|
9
10
|
import { ConfigError } from "@aui.io/apollo-core/errors/index.js";
|
|
@@ -11,12 +12,13 @@ import { importBundle, listVersions, localDiff, pullBundle, pushBundle, remoteDi
|
|
|
11
12
|
import { loginWithBrowser, loginWithOtp, loginWithToken, logout as logoutSession, requestOtp, } from "@aui.io/apollo-core/services/auth.js";
|
|
12
13
|
import { createClients } from "@aui.io/apollo-core/services/clients.js";
|
|
13
14
|
import { setEnvironment } from "@aui.io/apollo-core/services/env.service.js";
|
|
14
|
-
import { bindAgent, createAgent, createProject, listAgents, listOrganizations, listProjects, unlinkAgent, useOrganization, useProject, } from "@aui.io/apollo-core/services/hierarchy.js";
|
|
15
|
+
import { bindAgent, createAgent, createProject, initialVersionTag, listAgents, listOrganizations, listProjects, unlinkAgent, useOrganization, useProject, useVersion, } from "@aui.io/apollo-core/services/hierarchy.js";
|
|
15
16
|
import { createThread, debugInteraction, listAgentThreads, listMessages, listThreads, resolveSendVersion, trace as fetchTrace, } from "@aui.io/apollo-core/services/messaging.js";
|
|
16
17
|
import { createCollection, createEndpoint, deleteEndpoint, deleteMockDb, describeMockDb, executeEndpoint, exportMockDb, getEndpoint, inspectSession, listCollections, listEndpoints, normalizeSchema, parseJsonFlag, provisionMockDb, resetSession, rotateMgmtKey, rotateRuntimeKey, seedRows, statusMockDb, storedKeys, updateCollection, updateEndpoint, wireMockDbConnection, } from "@aui.io/apollo-core/services/mockdb.js";
|
|
17
18
|
import { listSecrets, parseVaultScopeLevel, removeSecretByName, scopeLevelLabel, setSecret, } from "@aui.io/apollo-core/services/vault.js";
|
|
18
19
|
import { deleteHub, hubRefCheck, hubStatus, listHubs, programHubRefs, } from "@aui.io/apollo-core/services/knowledge.js";
|
|
19
20
|
import { listProfiles, useProfile } from "@aui.io/apollo-core/services/profile.service.js";
|
|
21
|
+
import { pullScenarios, pullScores, pushScenarioBundle, pushScores, readLocalScores, scaffoldScenarios, scenariosPaths, syncScenarios, } from "@aui.io/apollo-core/services/scenarios.js";
|
|
20
22
|
import { getStatus } from "@aui.io/apollo-core/services/status.service.js";
|
|
21
23
|
import { upgradeCli } from "@aui.io/apollo-core/services/upgrade.js";
|
|
22
24
|
import { checkoutSchemasDir, installSchemas, } from "@aui.io/apollo-core/schemas/install.js";
|
|
@@ -72,11 +74,12 @@ export const IMPORT_LIVE_PREFIX = "live — ";
|
|
|
72
74
|
/**
|
|
73
75
|
* Version rows for the import picker: the live version first (row 0 = the
|
|
74
76
|
* picker default) when one exists, else just the tags — the caller shows
|
|
75
|
-
* the "no live version" notice. `live_version_id`
|
|
76
|
-
*
|
|
77
|
+
* the "no live version" notice. `live_version_id` matching (id or tag —
|
|
78
|
+
* both shapes exist in the wild) lives in core's findLiveVersion, shared
|
|
79
|
+
* with CLI import and sends.
|
|
77
80
|
*/
|
|
78
81
|
export function importVersionRows(agent, versions) {
|
|
79
|
-
const live =
|
|
82
|
+
const live = findLiveVersion(agent, versions);
|
|
80
83
|
const rest = versions
|
|
81
84
|
.filter((v) => v.id !== live?.id)
|
|
82
85
|
.map((v) => item(v.version_tag, v.version_tag, v.status));
|
|
@@ -276,9 +279,48 @@ export async function runSimpleCommand(name, context, args) {
|
|
|
276
279
|
toast: `Pulled ${pulled.files.length} schema(s) into ${homeishPath(pulled.directory)}`,
|
|
277
280
|
};
|
|
278
281
|
}
|
|
282
|
+
case "scenarios-pull": {
|
|
283
|
+
const pulled = await pullScenarios(context);
|
|
284
|
+
if (!pulled.found) {
|
|
285
|
+
return {
|
|
286
|
+
jumpTab: "bundle",
|
|
287
|
+
toast: "No remote scenarios bundle yet — /scenarios-generate starts one",
|
|
288
|
+
};
|
|
289
|
+
}
|
|
290
|
+
return {
|
|
291
|
+
jumpTab: "bundle",
|
|
292
|
+
toast: `Pulled scenarios bundle v${String(pulled.version)} — ${String(pulled.scenariosCount)} scenario(s), ${String(pulled.intentsCount)} intent file(s)`,
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
case "scores-pull": {
|
|
296
|
+
const pulled = await pullScores(context);
|
|
297
|
+
return {
|
|
298
|
+
jumpTab: "bundle",
|
|
299
|
+
toast: pulled.found
|
|
300
|
+
? `Pulled scores — ${String(pulled.pass)}/${String(pulled.total)} pass @ ${pulled.versionTag ?? "?"}`
|
|
301
|
+
: "No scores for this version yet",
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
case "scenarios-generate": {
|
|
305
|
+
if (!context.agentRoot) {
|
|
306
|
+
return { error: "Enter an agent checkout first — scenarios live in <checkout>/scenarios" };
|
|
307
|
+
}
|
|
308
|
+
const scaffolded = await scaffoldScenarios(context.agentRoot);
|
|
309
|
+
return {
|
|
310
|
+
jumpTab: "bundle",
|
|
311
|
+
toast: scaffolded.createdScenariosFile
|
|
312
|
+
? `Scaffolded ${homeishPath(scenariosPaths(context.agentRoot).dir)} — fill scenarios.json, then /scenarios-push`
|
|
313
|
+
: "scenarios/ already exists — nothing scaffolded",
|
|
314
|
+
};
|
|
315
|
+
}
|
|
279
316
|
case "wire": {
|
|
280
317
|
const wired = await wireMockDbConnection(context);
|
|
281
|
-
return {
|
|
318
|
+
return {
|
|
319
|
+
jumpTab: "mockdb",
|
|
320
|
+
// The wiring ships with the bundle — say so, or the author pushes
|
|
321
|
+
// a program whose sources still have no operations mapped.
|
|
322
|
+
toast: `Wired ${wired.connectionId} into bundle/src — fill operations, then /push`,
|
|
323
|
+
};
|
|
282
324
|
}
|
|
283
325
|
case "mdb-status": {
|
|
284
326
|
const status = await statusMockDb(context);
|
|
@@ -645,6 +687,26 @@ export async function applyPick(commandName, selectedId, context) {
|
|
|
645
687
|
},
|
|
646
688
|
};
|
|
647
689
|
}
|
|
690
|
+
case "version-use": {
|
|
691
|
+
if (!context.agentId)
|
|
692
|
+
return { error: "Select an agent first" };
|
|
693
|
+
let tag = selectedId;
|
|
694
|
+
// The shared version picker's "latest (live)" row: bind the actual
|
|
695
|
+
// live tag, not the literal word.
|
|
696
|
+
if (tag === "latest") {
|
|
697
|
+
const agent = await clients.management.getAgent(context.agentId);
|
|
698
|
+
const live = findLiveVersion(agent, (await clients.management.listVersions(context.agentId)).results);
|
|
699
|
+
if (!live)
|
|
700
|
+
return { error: "No live version — pick a tag" };
|
|
701
|
+
tag = live.version_tag;
|
|
702
|
+
}
|
|
703
|
+
const result = await useVersion(context, clients.management, tag);
|
|
704
|
+
return {
|
|
705
|
+
jumpTab: "bundle",
|
|
706
|
+
toast: `Using ${result.version.version_tag} (${result.version.status})`,
|
|
707
|
+
refreshScope: true,
|
|
708
|
+
};
|
|
709
|
+
}
|
|
648
710
|
case "version-publish": {
|
|
649
711
|
if (!context.agentId)
|
|
650
712
|
return { error: "Select an agent first" };
|
|
@@ -716,6 +778,38 @@ export async function runSheetAction(commandName, values, context) {
|
|
|
716
778
|
jumpTab: "scope",
|
|
717
779
|
};
|
|
718
780
|
}
|
|
781
|
+
case "scenarios-push": {
|
|
782
|
+
const notes = text("notes");
|
|
783
|
+
const bundle = await pushScenarioBundle(context, {
|
|
784
|
+
...(notes ? { notes } : {}),
|
|
785
|
+
});
|
|
786
|
+
const base = `Pushed scenarios bundle v${String(bundle.version)} — ${String(bundle.scenariosCount)} scenario(s), ${String(bundle.intentsCount)} intent file(s)`;
|
|
787
|
+
const skipScores = values["skip-scores"] === true;
|
|
788
|
+
const hasScores = !skipScores &&
|
|
789
|
+
context.agentRoot !== undefined &&
|
|
790
|
+
(await readLocalScores(context.agentRoot)) !== undefined;
|
|
791
|
+
if (hasScores) {
|
|
792
|
+
// The bundle landed; a scores failure must say so, not mask it.
|
|
793
|
+
try {
|
|
794
|
+
const scores = await pushScores(context, {
|
|
795
|
+
bundleVersion: bundle.version,
|
|
796
|
+
});
|
|
797
|
+
return {
|
|
798
|
+
jumpTab: "bundle",
|
|
799
|
+
toast: `${base} · scores ${String(scores.pass)}/${String(scores.total)} @ ${scores.versionTag}`,
|
|
800
|
+
};
|
|
801
|
+
}
|
|
802
|
+
catch (error) {
|
|
803
|
+
return {
|
|
804
|
+
error: `Bundle v${String(bundle.version)} pushed, but the scores push failed: ${error instanceof Error ? error.message : String(error)}`,
|
|
805
|
+
};
|
|
806
|
+
}
|
|
807
|
+
}
|
|
808
|
+
return {
|
|
809
|
+
jumpTab: "bundle",
|
|
810
|
+
toast: skipScores ? base : `${base} · no scores.json`,
|
|
811
|
+
};
|
|
812
|
+
}
|
|
719
813
|
case "pull": {
|
|
720
814
|
const tag = text("tag");
|
|
721
815
|
const dir = text("dir");
|
|
@@ -777,7 +871,7 @@ export async function runSheetAction(commandName, values, context) {
|
|
|
777
871
|
let note = `Provisioned mock DB for ${provisioned.agentId ?? "agent"}`;
|
|
778
872
|
if (values.wire === true) {
|
|
779
873
|
const wired = await wireMockDbConnection(context);
|
|
780
|
-
note += ` · wired ${wired.connectionId}`;
|
|
874
|
+
note += ` · wired ${wired.connectionId} into bundle/src`;
|
|
781
875
|
}
|
|
782
876
|
return { jumpTab: "mockdb", toast: note };
|
|
783
877
|
}
|
|
@@ -891,7 +985,11 @@ export async function runSheetAction(commandName, values, context) {
|
|
|
891
985
|
: await defaultCheckoutDir(homedir(), context.profile, context.environment, created.name, created.id);
|
|
892
986
|
const sourceDirectory = path.join(directory, "bundle", "src");
|
|
893
987
|
await mkdir(sourceDirectory, { recursive: true });
|
|
894
|
-
|
|
988
|
+
// Bind the server-seeded draft tag so the first push has its base
|
|
989
|
+
// (REPORTS-26); best-effort — unbound stays recoverable via
|
|
990
|
+
// /version-use.
|
|
991
|
+
const seededTag = await initialVersionTag(clients.management, created);
|
|
992
|
+
await bindAgent(context, created, directory, seededTag);
|
|
895
993
|
const slug = text("name")
|
|
896
994
|
.toLowerCase()
|
|
897
995
|
.replace(/[^a-z0-9]+/g, "-")
|
|
@@ -941,6 +1039,16 @@ export async function runSheetAction(commandName, values, context) {
|
|
|
941
1039
|
const imported = await importBundle(context, clients.management, agentId, destination, text("tag") || undefined);
|
|
942
1040
|
await installSkills(clients.runtime, destination, ["cursor", "claude"]);
|
|
943
1041
|
await installSchemas(clients.runtime, checkoutSchemasDir(destination));
|
|
1042
|
+
// Scenarios ride the import best-effort, like skills and schemas —
|
|
1043
|
+
// the checkout context is explicit because nothing is bound yet.
|
|
1044
|
+
const scenarios = await syncScenarios({
|
|
1045
|
+
...context,
|
|
1046
|
+
agentRoot: destination,
|
|
1047
|
+
agentId: agent.id,
|
|
1048
|
+
...(imported.binding.version_tag
|
|
1049
|
+
? { versionTag: imported.binding.version_tag }
|
|
1050
|
+
: {}),
|
|
1051
|
+
}, { clients });
|
|
944
1052
|
await registerCheckout(homedir(), {
|
|
945
1053
|
agent_id: agent.id,
|
|
946
1054
|
name: agent.name,
|
|
@@ -950,7 +1058,9 @@ export async function runSheetAction(commandName, values, context) {
|
|
|
950
1058
|
});
|
|
951
1059
|
process.chdir(destination);
|
|
952
1060
|
return {
|
|
953
|
-
toast: `Imported ${Object.keys(imported.files).length} files — entered ${homeishPath(destination)}
|
|
1061
|
+
toast: `Imported ${Object.keys(imported.files).length} files — entered ${homeishPath(destination)}${scenarios.found
|
|
1062
|
+
? ` · scenarios v${String(scenarios.version)}${scenarios.scoresFound ? " + scores" : ""}`
|
|
1063
|
+
: ""}`,
|
|
954
1064
|
refreshScope: true,
|
|
955
1065
|
jumpTab: "scope",
|
|
956
1066
|
};
|