@aui.io/apollo 0.1.15 → 0.1.17

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 (57) hide show
  1. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js +38 -8
  2. package/node_modules/@aui.io/apollo-cli/dist/src/commands/bundles.js.map +1 -1
  3. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js +25 -2
  4. package/node_modules/@aui.io/apollo-cli/dist/src/commands/hierarchy.js.map +1 -1
  5. package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.d.ts +3 -0
  6. package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.js +124 -0
  7. package/node_modules/@aui.io/apollo-cli/dist/src/commands/scenarios.js.map +1 -0
  8. package/node_modules/@aui.io/apollo-cli/dist/src/index.js +2 -0
  9. package/node_modules/@aui.io/apollo-cli/dist/src/index.js.map +1 -1
  10. package/node_modules/@aui.io/apollo-cli/package.json +3 -3
  11. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.d.ts +172 -1
  12. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js +59 -15
  13. package/node_modules/@aui.io/apollo-core/dist/src/api/agent-settings.js.map +1 -1
  14. package/node_modules/@aui.io/apollo-core/dist/src/api/client-types.d.ts +3 -0
  15. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.d.ts +15 -0
  16. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js +27 -7
  17. package/node_modules/@aui.io/apollo-core/dist/src/api/transport.js.map +1 -1
  18. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js +4 -4
  19. package/node_modules/@aui.io/apollo-core/dist/src/config/index.js.map +1 -1
  20. package/node_modules/@aui.io/apollo-core/dist/src/config/types.d.ts +2 -1
  21. package/node_modules/@aui.io/apollo-core/dist/src/index.d.ts +4 -2
  22. package/node_modules/@aui.io/apollo-core/dist/src/index.js +4 -2
  23. package/node_modules/@aui.io/apollo-core/dist/src/index.js.map +1 -1
  24. package/node_modules/@aui.io/apollo-core/dist/src/schemas/install.d.ts +13 -0
  25. package/node_modules/@aui.io/apollo-core/dist/src/schemas/install.js +28 -0
  26. package/node_modules/@aui.io/apollo-core/dist/src/schemas/install.js.map +1 -0
  27. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.d.ts +3 -2
  28. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js +10 -9
  29. package/node_modules/@aui.io/apollo-core/dist/src/services/clients.js.map +1 -1
  30. package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.d.ts +151 -0
  31. package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.js +459 -0
  32. package/node_modules/@aui.io/apollo-core/dist/src/services/scenarios.js.map +1 -0
  33. package/node_modules/@aui.io/apollo-core/package.json +1 -1
  34. package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js +32 -0
  35. package/node_modules/@aui.io/apollo-tui/dist/src/actions/registry.js.map +1 -1
  36. package/node_modules/@aui.io/apollo-tui/dist/src/activity/operationStore.js +3 -0
  37. package/node_modules/@aui.io/apollo-tui/dist/src/activity/operationStore.js.map +1 -1
  38. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.d.ts +3 -1
  39. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.js +3 -3
  40. package/node_modules/@aui.io/apollo-tui/dist/src/author/AuthorHome.js.map +1 -1
  41. package/node_modules/@aui.io/apollo-tui/dist/src/author/ScenariosView.d.ts +22 -0
  42. package/node_modules/@aui.io/apollo-tui/dist/src/author/ScenariosView.js +99 -0
  43. package/node_modules/@aui.io/apollo-tui/dist/src/author/ScenariosView.js.map +1 -0
  44. package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.d.ts +47 -0
  45. package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.js +284 -0
  46. package/node_modules/@aui.io/apollo-tui/dist/src/author/scenarios.js.map +1 -0
  47. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js +100 -4
  48. package/node_modules/@aui.io/apollo-tui/dist/src/lib/actions.js.map +1 -1
  49. package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js +44 -1
  50. package/node_modules/@aui.io/apollo-tui/dist/src/lib/commands.js.map +1 -1
  51. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js +159 -15
  52. package/node_modules/@aui.io/apollo-tui/dist/src/opentui-app.js.map +1 -1
  53. package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.d.ts +1 -1
  54. package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.js +1 -0
  55. package/node_modules/@aui.io/apollo-tui/dist/src/shell/FooterHints.js.map +1 -1
  56. package/node_modules/@aui.io/apollo-tui/package.json +2 -2
  57. 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"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,iBAAiB,GAGlB,MAAM,2CAA2C,CAAC;AAWnD,6EAA6E;AAC7E,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,YAAoB;IAEpB,IAAI,CAAC;QACH,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;YACxC,kBAAkB,CAAC,YAAY,CAAC;YAChC,eAAe,CAAC,YA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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"}
@@ -17,8 +17,10 @@ import { createCollection, createEndpoint, deleteEndpoint, deleteMockDb, describ
17
17
  import { listSecrets, parseVaultScopeLevel, removeSecretByName, scopeLevelLabel, setSecret, } from "@aui.io/apollo-core/services/vault.js";
18
18
  import { deleteHub, hubRefCheck, hubStatus, listHubs, programHubRefs, } from "@aui.io/apollo-core/services/knowledge.js";
19
19
  import { listProfiles, useProfile } from "@aui.io/apollo-core/services/profile.service.js";
20
+ import { pullScenarios, pullScores, pushScenarioBundle, pushScores, readLocalScores, scaffoldScenarios, scenariosPaths, syncScenarios, } from "@aui.io/apollo-core/services/scenarios.js";
20
21
  import { getStatus } from "@aui.io/apollo-core/services/status.service.js";
21
22
  import { upgradeCli } from "@aui.io/apollo-core/services/upgrade.js";
23
+ import { checkoutSchemasDir, installSchemas, } from "@aui.io/apollo-core/schemas/install.js";
22
24
  import { installSkills } from "@aui.io/apollo-core/skills/install.js";
23
25
  import { messagesToTurns } from "../talk/data.js";
24
26
  import { pickerDisplayName } from "./picker.js";
@@ -265,10 +267,48 @@ export async function runSimpleCommand(name, context, args) {
265
267
  };
266
268
  }
267
269
  case "schema-pull": {
268
- const schemas = await clients.agentSettings.pullSchemas();
270
+ // Schemas are files of the checkout, like skills — not a cache.
271
+ if (!context.agentRoot) {
272
+ return { error: "Enter an agent checkout first — schemas land in <checkout>/schemas" };
273
+ }
274
+ const pulled = await installSchemas(clients.runtime, checkoutSchemasDir(context.agentRoot));
275
+ return {
276
+ jumpTab: "bundle",
277
+ toast: `Pulled ${pulled.files.length} schema(s) into ${homeishPath(pulled.directory)}`,
278
+ };
279
+ }
280
+ case "scenarios-pull": {
281
+ const pulled = await pullScenarios(context);
282
+ if (!pulled.found) {
283
+ return {
284
+ jumpTab: "bundle",
285
+ toast: "No remote scenarios bundle yet — /scenarios-generate starts one",
286
+ };
287
+ }
288
+ return {
289
+ jumpTab: "bundle",
290
+ toast: `Pulled scenarios bundle v${String(pulled.version)} — ${String(pulled.scenariosCount)} scenario(s), ${String(pulled.intentsCount)} intent file(s)`,
291
+ };
292
+ }
293
+ case "scores-pull": {
294
+ const pulled = await pullScores(context);
295
+ return {
296
+ jumpTab: "bundle",
297
+ toast: pulled.found
298
+ ? `Pulled scores — ${String(pulled.pass)}/${String(pulled.total)} pass @ ${pulled.versionTag ?? "?"}`
299
+ : "No scores for this version yet",
300
+ };
301
+ }
302
+ case "scenarios-generate": {
303
+ if (!context.agentRoot) {
304
+ return { error: "Enter an agent checkout first — scenarios live in <checkout>/scenarios" };
305
+ }
306
+ const scaffolded = await scaffoldScenarios(context.agentRoot);
269
307
  return {
270
308
  jumpTab: "bundle",
271
- toast: `Pulled ${Object.keys(schemas).length} schema(s)`,
309
+ toast: scaffolded.createdScenariosFile
310
+ ? `Scaffolded ${homeishPath(scenariosPaths(context.agentRoot).dir)} — fill scenarios.json, then /scenarios-push`
311
+ : "scenarios/ already exists — nothing scaffolded",
272
312
  };
273
313
  }
274
314
  case "wire": {
@@ -711,6 +751,38 @@ export async function runSheetAction(commandName, values, context) {
711
751
  jumpTab: "scope",
712
752
  };
713
753
  }
754
+ case "scenarios-push": {
755
+ const notes = text("notes");
756
+ const bundle = await pushScenarioBundle(context, {
757
+ ...(notes ? { notes } : {}),
758
+ });
759
+ const base = `Pushed scenarios bundle v${String(bundle.version)} — ${String(bundle.scenariosCount)} scenario(s), ${String(bundle.intentsCount)} intent file(s)`;
760
+ const skipScores = values["skip-scores"] === true;
761
+ const hasScores = !skipScores &&
762
+ context.agentRoot !== undefined &&
763
+ (await readLocalScores(context.agentRoot)) !== undefined;
764
+ if (hasScores) {
765
+ // The bundle landed; a scores failure must say so, not mask it.
766
+ try {
767
+ const scores = await pushScores(context, {
768
+ bundleVersion: bundle.version,
769
+ });
770
+ return {
771
+ jumpTab: "bundle",
772
+ toast: `${base} · scores ${String(scores.pass)}/${String(scores.total)} @ ${scores.versionTag}`,
773
+ };
774
+ }
775
+ catch (error) {
776
+ return {
777
+ error: `Bundle v${String(bundle.version)} pushed, but the scores push failed: ${error instanceof Error ? error.message : String(error)}`,
778
+ };
779
+ }
780
+ }
781
+ return {
782
+ jumpTab: "bundle",
783
+ toast: skipScores ? base : `${base} · no scores.json`,
784
+ };
785
+ }
714
786
  case "pull": {
715
787
  const tag = text("tag");
716
788
  const dir = text("dir");
@@ -902,10 +974,21 @@ export async function runSheetAction(commandName, values, context) {
902
974
  profile: context.profile,
903
975
  environment: context.environment,
904
976
  });
977
+ // Skills + schemas ship with every checkout (same as agent-import).
978
+ // The agent already exists, so a fetch failure is a note, not an
979
+ // error — /schema-pull retries the schemas later.
980
+ let authoringNote = "";
981
+ try {
982
+ await installSkills(clients.runtime, directory, ["cursor", "claude"]);
983
+ await installSchemas(clients.runtime, checkoutSchemasDir(directory));
984
+ }
985
+ catch {
986
+ authoringNote = " (skills/schemas not installed — /schema-pull to retry)";
987
+ }
905
988
  // The TUI enters what it creates — position is the only selection.
906
989
  process.chdir(directory);
907
990
  return {
908
- toast: `Created ${created.name} — entered ${homeishPath(directory)}`,
991
+ toast: `Created ${created.name} — entered ${homeishPath(directory)}${authoringNote}`,
909
992
  refreshScope: true,
910
993
  jumpTab: "scope",
911
994
  };
@@ -924,6 +1007,17 @@ export async function runSheetAction(commandName, values, context) {
924
1007
  (await defaultCheckoutDir(homedir(), context.profile, context.environment, agent.name, agent.id));
925
1008
  const imported = await importBundle(context, clients.management, agentId, destination, text("tag") || undefined);
926
1009
  await installSkills(clients.runtime, destination, ["cursor", "claude"]);
1010
+ await installSchemas(clients.runtime, checkoutSchemasDir(destination));
1011
+ // Scenarios ride the import best-effort, like skills and schemas —
1012
+ // the checkout context is explicit because nothing is bound yet.
1013
+ const scenarios = await syncScenarios({
1014
+ ...context,
1015
+ agentRoot: destination,
1016
+ agentId: agent.id,
1017
+ ...(imported.binding.version_tag
1018
+ ? { versionTag: imported.binding.version_tag }
1019
+ : {}),
1020
+ }, { clients });
927
1021
  await registerCheckout(homedir(), {
928
1022
  agent_id: agent.id,
929
1023
  name: agent.name,
@@ -933,7 +1027,9 @@ export async function runSheetAction(commandName, values, context) {
933
1027
  });
934
1028
  process.chdir(destination);
935
1029
  return {
936
- toast: `Imported ${Object.keys(imported.files).length} files — entered ${homeishPath(destination)}`,
1030
+ toast: `Imported ${Object.keys(imported.files).length} files — entered ${homeishPath(destination)}${scenarios.found
1031
+ ? ` · scenarios v${String(scenarios.version)}${scenarios.scoresFound ? " + scores" : ""}`
1032
+ : ""}`,
937
1033
  refreshScope: true,
938
1034
  jumpTab: "scope",
939
1035
  };