@moxxy/cli 0.2.0 → 0.3.2

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/dist/bin.js CHANGED
@@ -3018,8 +3018,11 @@ var init_session = __esm({
3018
3018
  */
3019
3019
  getInfo() {
3020
3020
  let activeMode = null;
3021
+ let activeModeBadge = null;
3021
3022
  try {
3022
- activeMode = this.modes.getActive().name;
3023
+ const mode = this.modes.getActive();
3024
+ activeMode = mode.name;
3025
+ activeModeBadge = mode.badge ? { label: mode.badge.label, ...mode.badge.tone ? { tone: mode.badge.tone } : {} } : null;
3023
3026
  } catch {
3024
3027
  }
3025
3028
  const active = this.providers.getActiveName();
@@ -3041,6 +3044,7 @@ var init_session = __esm({
3041
3044
  supportsLiveModelDiscovery: p3.supportsLiveModelDiscovery === true
3042
3045
  })),
3043
3046
  activeMode,
3047
+ activeModeBadge,
3044
3048
  modes: this.modes.list().map((m3) => m3.name),
3045
3049
  tools: this.tools.list().map((t2) => ({
3046
3050
  name: t2.name,
@@ -83798,6 +83802,9 @@ function contextColor(pct2) {
83798
83802
  return Colors.busy;
83799
83803
  return void 0;
83800
83804
  }
83805
+ function badgeBackground(tone) {
83806
+ return tone === "attention" ? Colors.mode : Colors.chrome;
83807
+ }
83801
83808
  var Glyphs, Colors, Border;
83802
83809
  var init_theme = __esm({
83803
83810
  "../plugin-cli/dist/theme.js"() {
@@ -85704,7 +85711,7 @@ var init_ModeFooter = __esm({
85704
85711
  });
85705
85712
 
85706
85713
  // ../plugin-cli/dist/components/StatusLine.js
85707
- var import_jsx_runtime21, import_react42, StatusLine, ProviderBadge, BusyMarker, CONTEXT_BAR_WIDTH, ContextMeter;
85714
+ var import_jsx_runtime21, import_react42, StatusLine, ProviderBadge, ModeBadgePill, BusyMarker, CONTEXT_BAR_WIDTH, ContextMeter;
85708
85715
  var init_StatusLine = __esm({
85709
85716
  async "../plugin-cli/dist/components/StatusLine.js"() {
85710
85717
  import_jsx_runtime21 = __toESM(require_jsx_runtime());
@@ -85714,14 +85721,21 @@ var init_StatusLine = __esm({
85714
85721
  init_theme();
85715
85722
  await init_Spinner();
85716
85723
  await init_ModeFooter();
85717
- StatusLine = ({ busyStartedAt, queueCount, modeName, provider, model, mcp, contextUsed, contextWindow }) => {
85724
+ StatusLine = ({ busyStartedAt, queueCount, modeName, modeBadge, provider, model, mcp, contextUsed, contextWindow }) => {
85718
85725
  const busy = busyStartedAt != null;
85719
85726
  const showQueue = (queueCount ?? 0) > 0;
85720
85727
  const showMcp = !!(mcp && mcp.enabled > 0);
85721
85728
  const showCtx = !!(contextWindow && contextWindow > 0);
85722
- return (0, import_jsx_runtime21.jsxs)(Box_default, { justifyContent: "space-between", children: [(0, import_jsx_runtime21.jsx)(Box_default, { children: busy ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(BusyMarker, { startedAt: busyStartedAt }), showQueue ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: " " }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: `${Glyphs.contextUp} ${queueCount} queued` })] }) : null] }) : (0, import_jsx_runtime21.jsx)(ModeFooter, { modeName }) }), (0, import_jsx_runtime21.jsxs)(Box_default, { children: [(0, import_jsx_runtime21.jsx)(ProviderBadge, { name: provider }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${model}` }), showMcp ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: "mcp " }), (0, import_jsx_runtime21.jsx)(Text, { children: `${mcp.connected}/${mcp.enabled}` })] }) : null, showCtx ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), (0, import_jsx_runtime21.jsx)(ContextMeter, { used: contextUsed ?? 0, total: contextWindow })] }) : null] })] });
85729
+ const queuedTail = showQueue ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: " " }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: `${Glyphs.contextUp} ${queueCount} queued` })] }) : null;
85730
+ return (0, import_jsx_runtime21.jsxs)(Box_default, { justifyContent: "space-between", children: [(0, import_jsx_runtime21.jsx)(Box_default, { children: modeBadge ? (
85731
+ // Badged (autonomous) mode: the pill is pinned left at all times,
85732
+ // with the busy marker / idle hint trailing it — so the user always
85733
+ // sees the mode even mid-run, when a plain footer would be hidden.
85734
+ (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(ModeBadgePill, { badge: modeBadge }), (0, import_jsx_runtime21.jsx)(Text, { children: " " }), busy ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(BusyMarker, { startedAt: busyStartedAt }), queuedTail] }) : (0, import_jsx_runtime21.jsx)(Text, { color: Colors.chrome, dimColor: true, children: "Esc stops \xB7 shift+tab to change" })] })
85735
+ ) : busy ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(BusyMarker, { startedAt: busyStartedAt }), queuedTail] }) : (0, import_jsx_runtime21.jsx)(ModeFooter, { modeName }) }), (0, import_jsx_runtime21.jsxs)(Box_default, { children: [(0, import_jsx_runtime21.jsx)(ProviderBadge, { name: provider }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${model}` }), showMcp ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), (0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: "mcp " }), (0, import_jsx_runtime21.jsx)(Text, { children: `${mcp.connected}/${mcp.enabled}` })] }) : null, showCtx ? (0, import_jsx_runtime21.jsxs)(import_jsx_runtime21.Fragment, { children: [(0, import_jsx_runtime21.jsx)(Text, { dimColor: true, children: ` ${Glyphs.midDot} ` }), (0, import_jsx_runtime21.jsx)(ContextMeter, { used: contextUsed ?? 0, total: contextWindow })] }) : null] })] });
85723
85736
  };
85724
85737
  ProviderBadge = ({ name }) => (0, import_jsx_runtime21.jsx)(Text, { backgroundColor: Colors.chrome, color: "black", bold: true, children: ` ${name} ` });
85738
+ ModeBadgePill = ({ badge }) => (0, import_jsx_runtime21.jsx)(Text, { backgroundColor: badgeBackground(badge.tone), color: "black", bold: true, children: ` ${badge.label} ` });
85725
85739
  BusyMarker = ({ startedAt }) => {
85726
85740
  const [now, setNow] = (0, import_react42.useState)(() => Date.now());
85727
85741
  (0, import_react42.useEffect)(() => {
@@ -85792,6 +85806,13 @@ function getModeName(session) {
85792
85806
  return "(none)";
85793
85807
  }
85794
85808
  }
85809
+ function getModeBadge(session) {
85810
+ try {
85811
+ return session.getInfo().activeModeBadge;
85812
+ } catch {
85813
+ return null;
85814
+ }
85815
+ }
85795
85816
  function formatTokensShort(n2) {
85796
85817
  if (n2 >= 1e6)
85797
85818
  return `${(n2 / 1e6).toFixed(1)}M`;
@@ -88188,6 +88209,7 @@ var init_SessionView = __esm({
88188
88209
  const contextWindow = resolveContextWindow(session, activeModel2);
88189
88210
  const contextUsed = estimateContextTokens(session.log);
88190
88211
  const modeName = getModeName(session);
88212
+ const modeBadge = getModeBadge(session);
88191
88213
  const cycleMode = import_react62.default.useCallback(() => {
88192
88214
  const modes = session.modes.list();
88193
88215
  if (modes.length === 0)
@@ -88312,7 +88334,7 @@ var init_SessionView = __esm({
88312
88334
  const { resolve: resolve12 } = pendingApproval;
88313
88335
  permissions.setPendingApproval(null);
88314
88336
  resolve12(decision);
88315
- }, onPickerSelect: handlePickerSelect, onPickerCancel: () => setPicker(null), onSubmit: handleSubmit, onPasteText: images.handlePasteText }), (0, import_jsx_runtime34.jsx)(StatusLine, { busyStartedAt: turn.busy && !pendingPermission && !pendingApproval ? turn.busyStartedAt : null, queueCount: turn.queueCount, modeName, provider: providerName, model: activeModel2, mcp: mcpStatus, contextUsed, ...contextWindow ? { contextWindow } : {} })] });
88337
+ }, onPickerSelect: handlePickerSelect, onPickerCancel: () => setPicker(null), onSubmit: handleSubmit, onPasteText: images.handlePasteText }), (0, import_jsx_runtime34.jsx)(StatusLine, { busyStartedAt: turn.busy && !pendingPermission && !pendingApproval ? turn.busyStartedAt : null, queueCount: turn.queueCount, modeName, modeBadge, provider: providerName, model: activeModel2, mcp: mcpStatus, contextUsed, ...contextWindow ? { contextWindow } : {} })] });
88316
88338
  };
88317
88339
  }
88318
88340
  });
@@ -104278,15 +104300,14 @@ var CodexOAuthTranscriber = class {
104278
104300
  cause: err
104279
104301
  });
104280
104302
  }
104281
- const text = payload && typeof payload === "object" && typeof payload.text === "string" ? payload.text.trim() : "";
104282
- if (!text) {
104303
+ if (!payload || typeof payload !== "object" || typeof payload.text !== "string") {
104283
104304
  throw new MoxxyError({
104284
104305
  code: "PROVIDER_UNKNOWN_RESPONSE",
104285
- message: "Codex transcription returned an empty transcript.",
104306
+ message: "Codex transcription response was missing a text field.",
104286
104307
  context: { provider: CODEX_PROVIDER_ID, url: this.endpoint }
104287
104308
  });
104288
104309
  }
104289
- return { text };
104310
+ return { text: payload.text.trim() };
104290
104311
  }
104291
104312
  async loadTokens() {
104292
104313
  try {
@@ -105026,6 +105047,7 @@ async function* runToolUseMode(ctx) {
105026
105047
  });
105027
105048
  }
105028
105049
  async function* emitRequestsAndDetectStuck(ctx, toolUses, detector) {
105050
+ const emitted = [];
105029
105051
  for (const t2 of toolUses) {
105030
105052
  yield await ctx.emit({
105031
105053
  type: "tool_call_requested",
@@ -105036,8 +105058,20 @@ async function* emitRequestsAndDetectStuck(ctx, toolUses, detector) {
105036
105058
  name: t2.name,
105037
105059
  input: t2.input
105038
105060
  });
105061
+ emitted.push(t2);
105039
105062
  const sig = detector.record(t2.name, t2.input);
105040
105063
  if (sig.stuck) {
105064
+ for (const r2 of emitted) {
105065
+ yield await ctx.emit({
105066
+ type: "tool_result",
105067
+ sessionId: ctx.sessionId,
105068
+ turnId: ctx.turnId,
105069
+ source: "tool",
105070
+ callId: asToolCallId(r2.id),
105071
+ ok: false,
105072
+ error: { kind: "aborted", message: "tool-use loop aborted (stuck pattern) before this call ran" }
105073
+ });
105074
+ }
105041
105075
  const how = sig.kind === "near" ? "against the same target (only volatile args like maxBytes varied)" : "with identical input";
105042
105076
  yield await ctx.emit({
105043
105077
  type: "error",
@@ -106944,6 +106978,7 @@ function composeSystemPrompts2(user, layer) {
106944
106978
  ${user}`;
106945
106979
  }
106946
106980
  async function* emitRequestsAndDetectStuck2(ctx, toolUses, detector) {
106981
+ const emitted = [];
106947
106982
  for (const t2 of toolUses) {
106948
106983
  yield await ctx.emit({
106949
106984
  type: "tool_call_requested",
@@ -106954,8 +106989,20 @@ async function* emitRequestsAndDetectStuck2(ctx, toolUses, detector) {
106954
106989
  name: t2.name,
106955
106990
  input: t2.input
106956
106991
  });
106992
+ emitted.push(t2);
106957
106993
  const sig = detector.record(t2.name, t2.input);
106958
106994
  if (sig.stuck) {
106995
+ for (const r2 of emitted) {
106996
+ yield await ctx.emit({
106997
+ type: "tool_result",
106998
+ sessionId: ctx.sessionId,
106999
+ turnId: ctx.turnId,
107000
+ source: "tool",
107001
+ callId: asToolCallId(r2.id),
107002
+ ok: false,
107003
+ error: { kind: "aborted", message: "goal mode aborted (stuck pattern) before this call ran" }
107004
+ });
107005
+ }
106959
107006
  const how = sig.kind === "near" ? "against the same target (only volatile args varied)" : "with identical input";
106960
107007
  yield await ctx.emit({
106961
107008
  type: "plugin_event",
@@ -107017,6 +107064,10 @@ async function* executeToolUses2(ctx, toolUses, iteration) {
107017
107064
  var goalMode = defineMode({
107018
107065
  name: GOAL_MODE_NAME,
107019
107066
  description: "Autonomous goal loop: works across many turns until it calls goal_complete (tools auto-approved)",
107067
+ // Goal mode auto-approves tools and keeps working unattended, so channels
107068
+ // surface a persistent accent badge while it's active — the user must always
107069
+ // know the agent is driving itself.
107070
+ badge: { label: "GOAL", tone: "attention" },
107020
107071
  run: runGoalMode
107021
107072
  });
107022
107073
  var goalModePlugin = definePlugin({