@femtomc/mu-agent 26.2.116 → 26.2.117

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/extensions/ui.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,+BAA+B,CAAC;AA04CpF,wBAAgB,WAAW,CAAC,EAAE,EAAE,YAAY,QA6N3C;AAED,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/extensions/ui.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,YAAY,EAAoB,MAAM,+BAA+B,CAAC;AA89CpF,wBAAgB,WAAW,CAAC,EAAE,EAAE,YAAY,QA6N3C;AAED,eAAe,WAAW,CAAC"}
@@ -20,6 +20,8 @@ const UI_PICKER_TWO_PANE_LEFT_MIN = 24;
20
20
  const UI_PICKER_TWO_PANE_RIGHT_MIN = 32;
21
21
  const UI_PICKER_TWO_PANE_SEPARATOR_WIDTH = 3;
22
22
  const UI_PICKER_INTERACTION_HINT = "↑/↓ move · tab switch pane · enter select/submit · esc cancel · click rows";
23
+ const UI_ASYNC_WIDGET_DOCS_MAX = 4;
24
+ const UI_ASYNC_WIDGET_SNAPSHOT_MAX = 96;
23
25
  const UI_ENABLE_MOUSE_TRACKING = "\x1b[?1000h\x1b[?1006h";
24
26
  const UI_DISABLE_MOUSE_TRACKING = "\x1b[?1000l\x1b[?1006l";
25
27
  const UI_INTERACT_OVERLAY_OPTIONS = {
@@ -106,7 +108,7 @@ function retainPendingPromptsForActiveDocs(state) {
106
108
  return false;
107
109
  }
108
110
  if (pending.kind === "review") {
109
- return isStatusProfileStatusVariant(doc);
111
+ return isReviewStatusProfileStatusVariant(doc);
110
112
  }
111
113
  const actions = runnableActions(doc);
112
114
  if (actions.length === 0) {
@@ -160,7 +162,9 @@ function armAutoPromptForUiDocs(state, changedUiIds) {
160
162
  enqueuePendingPrompt(state, { kind: "action", uiId: doc.ui_id, actionId });
161
163
  state.promptedRevisionKeys.add(docRevisionKey(doc));
162
164
  }
163
- const statusCandidates = unpromptedDocs.filter((doc) => isStatusProfileStatusVariant(doc)).sort(byMostRecentRevision);
165
+ const statusCandidates = unpromptedDocs
166
+ .filter((doc) => isReviewStatusProfileStatusVariant(doc))
167
+ .sort(byMostRecentRevision);
164
168
  if (statusCandidates.length > 0) {
165
169
  const doc = statusCandidates[0];
166
170
  enqueuePendingPrompt(state, { kind: "review", uiId: doc.ui_id });
@@ -221,9 +225,39 @@ function statusProfileVariant(doc) {
221
225
  const rawVariant = typeof profile?.variant === "string" ? profile.variant.trim().toLowerCase() : "";
222
226
  return rawVariant.length > 0 ? rawVariant : "status";
223
227
  }
228
+ const UI_STATUS_PROFILE_ASYNC_DEFAULT_IDS = new Set([
229
+ "planning",
230
+ "subagents",
231
+ "control-flow",
232
+ "model-routing",
233
+ ]);
224
234
  function isStatusProfileStatusVariant(doc) {
225
235
  return statusProfileId(doc) !== null && statusProfileVariant(doc) === "status";
226
236
  }
237
+ function statusProfileDelivery(doc) {
238
+ if (!isStatusProfileStatusVariant(doc)) {
239
+ return "review";
240
+ }
241
+ const profile = statusProfileMetadata(doc);
242
+ const rawDelivery = typeof profile?.delivery === "string" ? profile.delivery.trim().toLowerCase() : "";
243
+ if (rawDelivery === "async") {
244
+ return "async";
245
+ }
246
+ if (rawDelivery === "review") {
247
+ return "review";
248
+ }
249
+ const profileId = statusProfileId(doc)?.trim().toLowerCase();
250
+ if (profileId && UI_STATUS_PROFILE_ASYNC_DEFAULT_IDS.has(profileId)) {
251
+ return "async";
252
+ }
253
+ return "review";
254
+ }
255
+ function isAsyncStatusProfileStatusVariant(doc) {
256
+ return isStatusProfileStatusVariant(doc) && statusProfileDelivery(doc) === "async";
257
+ }
258
+ function isReviewStatusProfileStatusVariant(doc) {
259
+ return isStatusProfileStatusVariant(doc) && statusProfileDelivery(doc) === "review";
260
+ }
227
261
  function statusProfileSnapshot(doc, format) {
228
262
  if (!isStatusProfileStatusVariant(doc)) {
229
263
  return null;
@@ -1137,6 +1171,40 @@ function buildToolResult(opts) {
1137
1171
  };
1138
1172
  return result;
1139
1173
  }
1174
+ function asyncStatusWidgetLines(ctx, docs) {
1175
+ if (!ctx.hasUI) {
1176
+ return null;
1177
+ }
1178
+ const asyncDocs = docs
1179
+ .filter((doc) => isAsyncStatusProfileStatusVariant(doc))
1180
+ .sort((left, right) => {
1181
+ if (left.updated_at_ms !== right.updated_at_ms) {
1182
+ return right.updated_at_ms - left.updated_at_ms;
1183
+ }
1184
+ return left.ui_id.localeCompare(right.ui_id);
1185
+ });
1186
+ if (asyncDocs.length === 0) {
1187
+ return null;
1188
+ }
1189
+ const visible = asyncDocs.slice(0, UI_ASYNC_WIDGET_DOCS_MAX);
1190
+ const lines = [
1191
+ ctx.ui.theme.fg("dim", `ui async status · ${asyncDocs.length} ${pluralize(asyncDocs.length, "doc")}`),
1192
+ ];
1193
+ for (const doc of visible) {
1194
+ const profileId = statusProfileId(doc) ?? doc.ui_id;
1195
+ const snapshot = statusProfileSnapshot(doc, "compact") ?? doc.summary ?? `${doc.title} (${doc.revision.version})`;
1196
+ lines.push([
1197
+ ctx.ui.theme.fg("muted", " •"),
1198
+ ctx.ui.theme.fg("text", short(profileId, 24)),
1199
+ ctx.ui.theme.fg("muted", "·"),
1200
+ ctx.ui.theme.fg("dim", short(snapshot, UI_ASYNC_WIDGET_SNAPSHOT_MAX)),
1201
+ ].join(" "));
1202
+ }
1203
+ if (asyncDocs.length > visible.length) {
1204
+ lines.push(ctx.ui.theme.fg("muted", ` ... (+${asyncDocs.length - visible.length} more)`));
1205
+ }
1206
+ return lines;
1207
+ }
1140
1208
  function refreshUi(ctx) {
1141
1209
  const key = sessionKey(ctx);
1142
1210
  const state = ensureState(key);
@@ -1151,22 +1219,32 @@ function refreshUi(ctx) {
1151
1219
  return;
1152
1220
  }
1153
1221
  const awaiting = awaitingDocs(state, docs);
1222
+ const asyncStatusDocs = docs.filter((doc) => isAsyncStatusProfileStatusVariant(doc));
1154
1223
  const labels = docs.map((doc) => doc.ui_id).join(", ");
1155
1224
  const readiness = state.interactionDepth > 0
1156
1225
  ? ctx.ui.theme.fg("accent", "prompting")
1157
1226
  : awaiting.length > 0
1158
1227
  ? ctx.ui.theme.fg("accent", `awaiting ${awaiting.length}`)
1159
1228
  : ctx.ui.theme.fg("dim", "ready");
1160
- ctx.ui.setStatus("mu-ui", [
1229
+ const statusParts = [
1161
1230
  ctx.ui.theme.fg("dim", "ui"),
1162
1231
  ctx.ui.theme.fg("muted", "·"),
1163
1232
  ctx.ui.theme.fg("accent", `${docs.length}`),
1164
1233
  ctx.ui.theme.fg("muted", "·"),
1165
1234
  readiness,
1166
- ctx.ui.theme.fg("muted", "·"),
1167
- ctx.ui.theme.fg("text", labels),
1168
- ].join(" "));
1169
- ctx.ui.setWidget("mu-ui", undefined);
1235
+ ];
1236
+ if (asyncStatusDocs.length > 0) {
1237
+ statusParts.push(ctx.ui.theme.fg("muted", "·"), ctx.ui.theme.fg("dim", `async ${asyncStatusDocs.length}`));
1238
+ }
1239
+ statusParts.push(ctx.ui.theme.fg("muted", "·"), ctx.ui.theme.fg("text", labels));
1240
+ ctx.ui.setStatus("mu-ui", statusParts.join(" "));
1241
+ const widgetLines = asyncStatusWidgetLines(ctx, docs);
1242
+ if (widgetLines && widgetLines.length > 0) {
1243
+ ctx.ui.setWidget("mu-ui", widgetLines, { placement: "belowEditor" });
1244
+ }
1245
+ else {
1246
+ ctx.ui.setWidget("mu-ui", undefined);
1247
+ }
1170
1248
  }
1171
1249
  export function uiExtension(pi) {
1172
1250
  const commandUsage = "/mu ui status|snapshot [compact|multiline]|interact [ui_id [action_id]]";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@femtomc/mu-agent",
3
- "version": "26.2.116",
3
+ "version": "26.2.117",
4
4
  "description": "Shared operator runtime for mu assistant sessions and serve extensions.",
5
5
  "keywords": [
6
6
  "mu",
@@ -24,7 +24,7 @@
24
24
  "themes/**"
25
25
  ],
26
26
  "dependencies": {
27
- "@femtomc/mu-core": "26.2.116",
27
+ "@femtomc/mu-core": "26.2.117",
28
28
  "@mariozechner/pi-agent-core": "^0.54.2",
29
29
  "@mariozechner/pi-ai": "^0.54.2",
30
30
  "@mariozechner/pi-coding-agent": "^0.54.2",