nolo-cli 0.69.0-alpha.1 → 0.69.0-alpha.3

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 (95) hide show
  1. package/{_executeModel-YXI7ADJF.js → _executeModel-DFUPTH24.js} +30 -30
  2. package/{action-AOORTHTU.js → action-D22U6CTH.js} +4 -4
  3. package/{addContentAction-E3S6F3IS.js → addContentAction-XAPUTGL4.js} +3 -3
  4. package/{addDialogAgentAction-EUBNJ5SS.js → addDialogAgentAction-M7VLLBZM.js} +2 -2
  5. package/{agentDeleteCommand-B5SKAPTR.js → agentDeleteCommand-VNTOS6BE.js} +16 -16
  6. package/{agentEmailCommands-LXGAJ3WU.js → agentEmailCommands-5SUJUECH.js} +35 -35
  7. package/{agentListCommands-D2E7SFRQ.js → agentListCommands-RA5NNNII.js} +18 -18
  8. package/{agentMachineCommands-W35VHNJN.js → agentMachineCommands-Q3IGMXRD.js} +17 -17
  9. package/{agentRecordCommands-JKA6W77W.js → agentRecordCommands-NSGMEUHK.js} +34 -34
  10. package/{agentRunCommand-DFMXY5SI.js → agentRunCommand-BO77DK64.js} +34 -34
  11. package/{agentRuntimeLocal-T47DU3IA.js → agentRuntimeLocal-WDIBAXHF.js} +16 -16
  12. package/{agentSlice-K5IE7FV3.js → agentSlice-FT52UJXF.js} +3 -3
  13. package/{appDeleteCommands-URD2F5YN.js → appDeleteCommands-OVJIOW2J.js} +16 -16
  14. package/{appDeployCommands-OACWEEWP.js → appDeployCommands-BF3I5ZYA.js} +16 -16
  15. package/{appDeployStatusCommands-TVYLIUEU.js → appDeployStatusCommands-EYEKXIWI.js} +16 -16
  16. package/{appGetCommands-ZWG2YEAE.js → appGetCommands-HIGRIFZO.js} +16 -16
  17. package/{appListCommands-E3BMSQEY.js → appListCommands-BIP7SMU4.js} +16 -16
  18. package/{authCommand-QHMBXOOH.js → authCommand-EVGFLAHO.js} +7 -7
  19. package/{chatQueueReduxAdapter-HL5A3L2W.js → chatQueueReduxAdapter-K5KB3KAK.js} +13 -13
  20. package/{chunk-2L7EUBRN.js → chunk-3BIRZJCI.js} +4 -4
  21. package/{chunk-RJ5HQDHL.js → chunk-3QPYFHAH.js} +1 -1
  22. package/{chunk-IOZR6BLM.js → chunk-3U3EA3BO.js} +1 -1
  23. package/{chunk-7JS3F5ZR.js → chunk-4EJ5QYB5.js} +1 -1
  24. package/{chunk-HFC7I2SI.js → chunk-5CCXNZTD.js} +32 -24
  25. package/{chunk-4MKPBCTN.js → chunk-5J7W2VWW.js} +2 -3
  26. package/{chunk-V3B6FQKC.js → chunk-62NIW5JP.js} +12 -12
  27. package/{chunk-5YIL5WDC.js → chunk-AJHEFRGJ.js} +220 -71
  28. package/{chunk-76JAMDUT.js → chunk-BJCWNHVU.js} +2 -2
  29. package/{chunk-OMHOVU2L.js → chunk-CLUJ44KW.js} +1 -1
  30. package/{chunk-VLQRD7ZJ.js → chunk-CMH2SYHX.js} +2 -2
  31. package/{chunk-2XENHR3P.js → chunk-DSRXPQWA.js} +4 -4
  32. package/{chunk-3E67YXGD.js → chunk-E36HZARC.js} +2 -2
  33. package/{chunk-JFPBCEFP.js → chunk-ETVDF66U.js} +15 -16
  34. package/{chunk-SHPRRU2W.js → chunk-EXMHJN7C.js} +2 -2
  35. package/{chunk-UFTOGLCE.js → chunk-FPTQQSS6.js} +1 -1
  36. package/{chunk-SKWZFK56.js → chunk-FUZRQKU2.js} +4 -4
  37. package/{chunk-BNATE77Z.js → chunk-GBPZKFYK.js} +1 -1
  38. package/{chunk-6RNOFHEM.js → chunk-GUR5O7MB.js} +26 -26
  39. package/{chunk-ZCVO2HLZ.js → chunk-HXAINXPQ.js} +4 -4
  40. package/{chunk-MNIB5JKP.js → chunk-I5N43M6M.js} +1 -1
  41. package/{chunk-SQDGTW2T.js → chunk-K7AG465Q.js} +2 -4
  42. package/{chunk-Y7PULBIA.js → chunk-KIS76A2P.js} +1 -1
  43. package/{chunk-ZXB3C27J.js → chunk-L77RUZVI.js} +3 -3
  44. package/{chunk-C2SHPJSS.js → chunk-LW2BWHRM.js} +28 -38
  45. package/{chunk-RXYIUZU5.js → chunk-LWFMRMP2.js} +8 -8
  46. package/{chunk-6IT5ECCC.js → chunk-NG4UT4K4.js} +1 -1
  47. package/{chunk-ZW22L5ES.js → chunk-PGSKWZCB.js} +1 -1
  48. package/{chunk-XTJTN3RW.js → chunk-PUOC4YRO.js} +0 -4
  49. package/{chunk-RSDPPLSM.js → chunk-PYXL2CJL.js} +1 -1
  50. package/{chunk-K647EQV3.js → chunk-PZM3EENV.js} +1 -1
  51. package/{chunk-4ENGEYUY.js → chunk-R2PJ4WKV.js} +4 -4
  52. package/{chunk-WMRPXIZY.js → chunk-SZLVDREM.js} +1 -1
  53. package/{chunk-5TJQUZQ7.js → chunk-UDQWGU7F.js} +1 -1
  54. package/{chunk-TQC77XVE.js → chunk-UJ63UXGE.js} +1 -1
  55. package/{chunk-PADUIVUU.js → chunk-VD2NV6C5.js} +3 -3
  56. package/{chunk-LMEH4C4G.js → chunk-WGBSEJ5K.js} +3 -3
  57. package/{chunk-OPNHMILE.js → chunk-XWNRAIUL.js} +2 -2
  58. package/{chunk-4K6DB3GJ.js → chunk-YFADVSZE.js} +3 -3
  59. package/{chunk-KRR3AG7T.js → chunk-ZLPA7K55.js} +3 -3
  60. package/{chunk-VOEOMLKR.js → chunk-ZW7BZH2L.js} +9 -9
  61. package/{chunk-IM5EETJX.js → chunk-ZZCJUXUI.js} +1 -1
  62. package/{contentThunks-XV3U3V2O.js → contentThunks-EAWBISNO.js} +14 -14
  63. package/{createAgentAutomationAction-UKKP6SAJ.js → createAgentAutomationAction-QSJZAWUD.js} +14 -14
  64. package/{createDialogAction-WK6Y7DD7.js → createDialogAction-7OMDWUQ2.js} +15 -15
  65. package/{createPageAction-SLRDORVZ.js → createPageAction-5YRHFLR5.js} +14 -14
  66. package/{dbSlice-WL5T2LVF.js → dbSlice-GKGGFNOB.js} +2 -2
  67. package/{dialogCommands-E5AAV7PB.js → dialogCommands-J6JW5543.js} +16 -16
  68. package/{dialogSlice-2TSABNK5.js → dialogSlice-7S2IE53T.js} +13 -13
  69. package/{docCreateCommands-N7P5VBTU.js → docCreateCommands-OKBRNLDP.js} +16 -16
  70. package/{docDeleteCommands-LZPPUYY6.js → docDeleteCommands-G7L466BF.js} +16 -16
  71. package/{docReadCommands-UCQGMMBR.js → docReadCommands-LR77KH6M.js} +16 -16
  72. package/{docStore-GX4LBBIB.js → docStore-AETL5FRN.js} +3 -3
  73. package/{docUpdateCommands-H57EVVVE.js → docUpdateCommands-ZOICHED3.js} +16 -16
  74. package/{getPricing-JRNHI5CV.js → getPricing-HRMSOF3E.js} +3 -3
  75. package/{handleSendMessageAction-DYAB4HTU.js → handleSendMessageAction-2BZIEE2M.js} +13 -13
  76. package/index.js +47 -47
  77. package/{machineCommands-7G33TEID.js → machineCommands-XW5Y7WIZ.js} +34 -34
  78. package/{machineWsRunDispatch-5I4IU4FF.js → machineWsRunDispatch-W5CWYIMG.js} +34 -34
  79. package/{memberThunks-OBDDU3NR.js → memberThunks-KATHH3F4.js} +3 -3
  80. package/{models-NBVTQACP.js → models-GS72DVJS.js} +2 -2
  81. package/package.json +1 -1
  82. package/{read-OOTHDABU.js → read-LC6HVYBN.js} +1 -1
  83. package/{readDocTool-OU4QXJT6.js → readDocTool-N3ERJHHF.js} +1 -1
  84. package/{readlineWorkspace-5A2BHFDV.js → readlineWorkspace-UPNB3WUE.js} +231 -119
  85. package/{removeDialogAgentAction-BVU6E27N.js → removeDialogAgentAction-F5GPTALR.js} +4 -4
  86. package/{runAgentClientLoop-VZCX37ZP.js → runAgentClientLoop-CAS5IJWE.js} +28 -28
  87. package/{setDialogExtraReferencesAction-AUKADSTQ.js → setDialogExtraReferencesAction-AY4ZCF3A.js} +3 -3
  88. package/{setPrimaryDialogAgentAction-HMHZWURC.js → setPrimaryDialogAgentAction-HPMG7V3R.js} +4 -4
  89. package/{settingSlice-HIQRILF5.js → settingSlice-OEJA4NQO.js} +3 -3
  90. package/{spaceCommands-ANELRNRF.js → spaceCommands-FZXF2UST.js} +16 -16
  91. package/{streamAgentChatTurn-QM364J6U.js → streamAgentChatTurn-3RGW4I7T.js} +32 -32
  92. package/{switchDialogAgentAction-Y66ZTIGP.js → switchDialogAgentAction-HMDZTZ4I.js} +2 -2
  93. package/{tools-YNRN4HC7.js → tools-YFW6QGIZ.js} +22 -22
  94. package/{tuiSummaryLlmCaller-ZGATEM35.js → tuiSummaryLlmCaller-J5BEPLW5.js} +10 -10
  95. package/{updateDialogTitleAction-OOYKI7LI.js → updateDialogTitleAction-QAUF6YRW.js} +14 -14
@@ -72,7 +72,7 @@ import {
72
72
  wrapTextToLines,
73
73
  wrapTranscriptLine,
74
74
  wrapTranscriptLineWithLayout
75
- } from "./chunk-JFPBCEFP.js";
75
+ } from "./chunk-ETVDF66U.js";
76
76
  import "./chunk-S7Z2HMCN.js";
77
77
  import {
78
78
  listFavoriteAgentIdsAcrossServers,
@@ -80,7 +80,7 @@ import {
80
80
  listRemoteAgents,
81
81
  listRemoteAgentsAcrossServers,
82
82
  normalizeListedAgent
83
- } from "./chunk-IOZR6BLM.js";
83
+ } from "./chunk-3U3EA3BO.js";
84
84
  import "./chunk-ID4G2MAR.js";
85
85
  import {
86
86
  listUserRecordsFromServers,
@@ -96,8 +96,8 @@ import {
96
96
  readTimestamp,
97
97
  setCliLocale,
98
98
  t
99
- } from "./chunk-HFC7I2SI.js";
100
- import "./chunk-BNATE77Z.js";
99
+ } from "./chunk-5CCXNZTD.js";
100
+ import "./chunk-GBPZKFYK.js";
101
101
  import "./chunk-EADNWBAZ.js";
102
102
  import {
103
103
  backfillRunRecordParentDialog,
@@ -129,17 +129,17 @@ import "./chunk-MP64VFGD.js";
129
129
  import "./chunk-ESHYE7WU.js";
130
130
  import "./chunk-JBTJAPUF.js";
131
131
  import "./chunk-LTRXGFMS.js";
132
- import "./chunk-RJ5HQDHL.js";
132
+ import "./chunk-3QPYFHAH.js";
133
133
  import "./chunk-ATNTHIZI.js";
134
134
  import "./chunk-JEXVIMYZ.js";
135
135
  import {
136
136
  prepareTools
137
- } from "./chunk-LMEH4C4G.js";
137
+ } from "./chunk-WGBSEJ5K.js";
138
138
  import {
139
139
  buildResponseGuidelines
140
140
  } from "./chunk-EDKF7RX4.js";
141
141
  import "./chunk-HS7MLR74.js";
142
- import "./chunk-6RNOFHEM.js";
142
+ import "./chunk-GUR5O7MB.js";
143
143
  import "./chunk-5XTOKQLW.js";
144
144
  import "./chunk-NF64D32W.js";
145
145
  import "./chunk-3L2WKC3W.js";
@@ -154,30 +154,30 @@ import {
154
154
  runShowsLogTail,
155
155
  shortRunId
156
156
  } from "./chunk-NTW5GWDM.js";
157
- import "./chunk-UFTOGLCE.js";
157
+ import "./chunk-FPTQQSS6.js";
158
158
  import "./chunk-KQHGZWSV.js";
159
- import "./chunk-5TJQUZQ7.js";
160
- import "./chunk-K647EQV3.js";
159
+ import "./chunk-UDQWGU7F.js";
160
+ import "./chunk-PZM3EENV.js";
161
161
  import "./chunk-OZX2IPKM.js";
162
- import "./chunk-7JS3F5ZR.js";
162
+ import "./chunk-4EJ5QYB5.js";
163
163
  import "./chunk-N4G4PKQ6.js";
164
164
  import "./chunk-FZGV4FGK.js";
165
165
  import "./chunk-MEYIRKDN.js";
166
166
  import "./chunk-63W5N6P3.js";
167
167
  import "./chunk-VF4K2QE6.js";
168
- import "./chunk-PADUIVUU.js";
169
- import "./chunk-SKWZFK56.js";
170
- import "./chunk-2L7EUBRN.js";
168
+ import "./chunk-VD2NV6C5.js";
169
+ import "./chunk-FUZRQKU2.js";
170
+ import "./chunk-3BIRZJCI.js";
171
171
  import "./chunk-ZJ7UHBJS.js";
172
172
  import {
173
173
  extractReferenceKeysFromMessage
174
- } from "./chunk-C2SHPJSS.js";
174
+ } from "./chunk-LW2BWHRM.js";
175
175
  import "./chunk-EVBFYPDC.js";
176
176
  import "./chunk-HQUORJTM.js";
177
177
  import "./chunk-YYLHWIW6.js";
178
178
  import "./chunk-AGGIDPCZ.js";
179
- import "./chunk-4ENGEYUY.js";
180
- import "./chunk-76JAMDUT.js";
179
+ import "./chunk-R2PJ4WKV.js";
180
+ import "./chunk-BJCWNHVU.js";
181
181
  import "./chunk-5RGU3J7P.js";
182
182
  import "./chunk-6YTOJY35.js";
183
183
  import "./chunk-M76ECQRD.js";
@@ -201,22 +201,22 @@ import {
201
201
  buildLocalWorkspaceToolset,
202
202
  getProcessRegistry,
203
203
  readCommandActionGatePayload
204
- } from "./chunk-RXYIUZU5.js";
205
- import "./chunk-ZCVO2HLZ.js";
204
+ } from "./chunk-LWFMRMP2.js";
205
+ import "./chunk-HXAINXPQ.js";
206
206
  import "./chunk-ZNFJWEN4.js";
207
- import "./chunk-Y7PULBIA.js";
207
+ import "./chunk-KIS76A2P.js";
208
208
  import "./chunk-2QDDKFG5.js";
209
209
  import "./chunk-N7J63Q6C.js";
210
210
  import {
211
211
  buildIdentityBlock,
212
212
  buildRuntimeGuidanceBlocks,
213
213
  resolveToolGuidedSections
214
- } from "./chunk-KRR3AG7T.js";
215
- import "./chunk-XTJTN3RW.js";
216
- import "./chunk-ZW22L5ES.js";
214
+ } from "./chunk-ZLPA7K55.js";
215
+ import "./chunk-PUOC4YRO.js";
216
+ import "./chunk-PGSKWZCB.js";
217
217
  import {
218
218
  resolvePlatformAuthToken
219
- } from "./chunk-VLQRD7ZJ.js";
219
+ } from "./chunk-CMH2SYHX.js";
220
220
  import "./chunk-V3ZKNK5D.js";
221
221
  import {
222
222
  isQuotaExhaustedError
@@ -226,7 +226,7 @@ import {
226
226
  DEFAULT_CONTEXT_WINDOW,
227
227
  getModelContextWindow,
228
228
  normalizeUsage
229
- } from "./chunk-2XENHR3P.js";
229
+ } from "./chunk-DSRXPQWA.js";
230
230
  import {
231
231
  buildCompactionMetricsFromPlan,
232
232
  buildCompactionUserContent,
@@ -236,13 +236,13 @@ import {
236
236
  formatMessagesForSummaryWithTruncation,
237
237
  planCompression,
238
238
  serializeMessageContent
239
- } from "./chunk-3E67YXGD.js";
240
- import "./chunk-SQDGTW2T.js";
239
+ } from "./chunk-E36HZARC.js";
240
+ import "./chunk-K7AG465Q.js";
241
241
  import {
242
242
  estimateTokenCount
243
243
  } from "./chunk-PSCNXBYA.js";
244
244
  import "./chunk-BYXBJQAS.js";
245
- import "./chunk-TQC77XVE.js";
245
+ import "./chunk-UJ63UXGE.js";
246
246
  import {
247
247
  compactWhitespace
248
248
  } from "./chunk-DWLEOOGR.js";
@@ -292,16 +292,16 @@ import {
292
292
  import {
293
293
  DEFAULT_NOLO_SERVER_URL
294
294
  } from "./chunk-OLZBQWZU.js";
295
- import "./chunk-6IT5ECCC.js";
296
- import "./chunk-5YIL5WDC.js";
297
- import "./chunk-WMRPXIZY.js";
298
- import "./chunk-OPNHMILE.js";
295
+ import "./chunk-NG4UT4K4.js";
296
+ import "./chunk-AJHEFRGJ.js";
297
+ import "./chunk-SZLVDREM.js";
298
+ import "./chunk-XWNRAIUL.js";
299
299
  import "./chunk-Y5GCAMGP.js";
300
300
  import "./chunk-UZ6XXCVR.js";
301
301
  import "./chunk-KX6YBIHG.js";
302
- import "./chunk-IM5EETJX.js";
302
+ import "./chunk-ZZCJUXUI.js";
303
303
  import "./chunk-UAD2WT54.js";
304
- import "./chunk-4K6DB3GJ.js";
304
+ import "./chunk-YFADVSZE.js";
305
305
  import "./chunk-NHRQCXIQ.js";
306
306
  import "./chunk-WWC7I6TA.js";
307
307
  import "./chunk-I42VC5KR.js";
@@ -314,7 +314,7 @@ import {
314
314
  BUILTIN_NOLO_AGENT_MODEL,
315
315
  BUILTIN_NOLO_AGENT_NAME,
316
316
  builtinAgentCatalogEntryById
317
- } from "./chunk-4MKPBCTN.js";
317
+ } from "./chunk-5J7W2VWW.js";
318
318
  import {
319
319
  extractCustomId,
320
320
  parsePublicAgentId
@@ -6806,18 +6806,50 @@ function normalizeQuestion(raw, index) {
6806
6806
  required: raw?.required !== false
6807
6807
  };
6808
6808
  }
6809
- function createInitialAskChoiceState(questions) {
6809
+ function createInitialAskChoiceState(questions, savedAnswers) {
6810
+ const hasSaved = Boolean(
6811
+ savedAnswers?.answers?.length || savedAnswers?.selected || savedAnswers?.phase === "submitted"
6812
+ );
6810
6813
  return {
6811
6814
  questions,
6812
6815
  activeIndex: 0,
6813
- questionStates: questions.map(() => ({
6814
- cursorIndex: 0,
6815
- selectedIds: [],
6816
- pickedId: null,
6817
- otherText: "",
6818
- otherFocused: false
6819
- })),
6820
- phase: "active"
6816
+ questionStates: questions.map((q, i) => {
6817
+ let pickedId = null;
6818
+ let selectedIds = [];
6819
+ let otherText = "";
6820
+ if (savedAnswers?.answers?.length) {
6821
+ const byId = savedAnswers.answers.find((a) => a.questionId === q.id);
6822
+ const byPosition = savedAnswers.answers[i]?.questionId ? void 0 : savedAnswers.answers[i];
6823
+ const found = byId ?? byPosition;
6824
+ if (found) {
6825
+ selectedIds = Array.isArray(found.selectedIds) ? found.selectedIds : [];
6826
+ otherText = typeof found.otherText === "string" ? found.otherText : "";
6827
+ if (!q.multiSelect && selectedIds.length > 0) {
6828
+ pickedId = selectedIds[0];
6829
+ }
6830
+ }
6831
+ } else if (savedAnswers?.selected) {
6832
+ const label = savedAnswers.selected.label;
6833
+ const matched = q.choices.find(
6834
+ (c) => c.label === label || savedAnswers.selected?.userMessage && c.userMessage === savedAnswers.selected.userMessage
6835
+ );
6836
+ if (matched) {
6837
+ pickedId = matched.id;
6838
+ selectedIds = [matched.id];
6839
+ } else if (label) {
6840
+ otherText = label;
6841
+ }
6842
+ }
6843
+ return {
6844
+ cursorIndex: 0,
6845
+ selectedIds,
6846
+ pickedId,
6847
+ otherText,
6848
+ otherFocused: false
6849
+ };
6850
+ }),
6851
+ phase: savedAnswers?.phase ?? (hasSaved ? "submitted" : "active"),
6852
+ validationAttempted: false
6821
6853
  };
6822
6854
  }
6823
6855
  function askChoiceReducer(state, action) {
@@ -6847,8 +6879,15 @@ function askChoiceReducer(state, action) {
6847
6879
  case "CANCEL":
6848
6880
  return { ...state, phase: "cancelled" };
6849
6881
  case "SUBMIT": {
6850
- if (!canSubmit(state)) return state;
6851
- return { ...state, phase: "submitted" };
6882
+ const firstUnanswered = findFirstUnansweredIndex(state);
6883
+ if (firstUnanswered !== -1) {
6884
+ return {
6885
+ ...state,
6886
+ activeIndex: firstUnanswered,
6887
+ validationAttempted: true
6888
+ };
6889
+ }
6890
+ return { ...state, phase: "submitted", validationAttempted: false };
6852
6891
  }
6853
6892
  case "SWITCH_TAB": {
6854
6893
  const idx = clamp(action.index, 0, state.questions.length - 1);
@@ -6878,58 +6917,62 @@ function askChoiceReducer(state, action) {
6878
6917
  case "TOGGLE_AT_CURSOR": {
6879
6918
  const qs = state.questionStates[state.activeIndex];
6880
6919
  const q = state.questions[state.activeIndex];
6881
- if (!q.multiSelect) return state;
6920
+ if (!q.multiSelect) {
6921
+ return askChoiceReducer(state, { type: "SELECT_AT_CURSOR" });
6922
+ }
6882
6923
  const isOtherRow = qs.cursorIndex >= q.choices.length;
6883
6924
  if (isOtherRow) {
6884
- const newQs2 = [...state.questionStates];
6885
- newQs2[state.activeIndex] = { ...qs, otherFocused: !qs.otherFocused };
6886
- return { ...state, questionStates: newQs2 };
6925
+ const newQs = [...state.questionStates];
6926
+ newQs[state.activeIndex] = { ...qs, otherFocused: !qs.otherFocused };
6927
+ return { ...state, questionStates: newQs };
6887
6928
  }
6888
6929
  const choiceId = q.choices[qs.cursorIndex]?.id;
6889
6930
  if (!choiceId) return state;
6890
- const has = qs.selectedIds.includes(choiceId);
6891
- const newSelected = has ? qs.selectedIds.filter((id) => id !== choiceId) : [...qs.selectedIds, choiceId];
6931
+ return askChoiceReducer(state, { type: "SELECT_CHOICE", choiceId });
6932
+ }
6933
+ // The one explicit "choose this option" action, addressed by choice id so
6934
+ // that click / tap handlers on every platform share the same behaviour as
6935
+ // cursor-driven keys. Multi-select toggles, single-select picks. It never
6936
+ // advances the tab and never submits.
6937
+ case "SELECT_CHOICE": {
6938
+ const qs = state.questionStates[state.activeIndex];
6939
+ const q = state.questions[state.activeIndex];
6940
+ const choiceIndex = q.choices.findIndex((c) => c.id === action.choiceId);
6941
+ if (choiceIndex === -1) return state;
6892
6942
  const newQs = [...state.questionStates];
6893
- newQs[state.activeIndex] = { ...qs, selectedIds: newSelected };
6894
- return { ...state, questionStates: newQs };
6943
+ if (q.multiSelect) {
6944
+ const has = qs.selectedIds.includes(action.choiceId);
6945
+ const newSelected = has ? qs.selectedIds.filter((id) => id !== action.choiceId) : [...qs.selectedIds, action.choiceId];
6946
+ newQs[state.activeIndex] = {
6947
+ ...qs,
6948
+ cursorIndex: choiceIndex,
6949
+ selectedIds: newSelected,
6950
+ otherText: "",
6951
+ otherFocused: false
6952
+ };
6953
+ } else {
6954
+ newQs[state.activeIndex] = {
6955
+ ...qs,
6956
+ cursorIndex: choiceIndex,
6957
+ pickedId: action.choiceId,
6958
+ otherText: "",
6959
+ otherFocused: false
6960
+ };
6961
+ }
6962
+ return { ...state, questionStates: newQs, validationAttempted: false };
6895
6963
  }
6896
6964
  case "SELECT_AT_CURSOR": {
6897
6965
  const qs = state.questionStates[state.activeIndex];
6898
6966
  const q = state.questions[state.activeIndex];
6899
6967
  const isOtherRow = qs.cursorIndex >= q.choices.length;
6900
6968
  if (isOtherRow) {
6901
- const newQs2 = [...state.questionStates];
6902
- newQs2[state.activeIndex] = { ...qs, otherFocused: true };
6903
- return { ...state, questionStates: newQs2 };
6969
+ const newQs = [...state.questionStates];
6970
+ newQs[state.activeIndex] = { ...qs, otherFocused: true };
6971
+ return { ...state, questionStates: newQs };
6904
6972
  }
6905
6973
  const choiceId = q.choices[qs.cursorIndex]?.id;
6906
6974
  if (!choiceId) return state;
6907
- if (q.multiSelect) {
6908
- const has = qs.selectedIds.includes(choiceId);
6909
- const newSelected = has ? qs.selectedIds.filter((id) => id !== choiceId) : [...qs.selectedIds, choiceId];
6910
- const newQs2 = [...state.questionStates];
6911
- newQs2[state.activeIndex] = { ...qs, selectedIds: newSelected };
6912
- return { ...state, questionStates: newQs2 };
6913
- }
6914
- const newQs = [...state.questionStates];
6915
- newQs[state.activeIndex] = { ...qs, pickedId: choiceId, otherFocused: false };
6916
- if (state.questions.length === 1) {
6917
- return {
6918
- ...state,
6919
- questionStates: newQs,
6920
- phase: "submitted"
6921
- };
6922
- }
6923
- const nextState = { ...state, questionStates: newQs };
6924
- const isLastTab = state.activeIndex >= state.questions.length - 1;
6925
- if (isLastTab && canSubmit(nextState)) {
6926
- return { ...nextState, phase: "submitted" };
6927
- }
6928
- const nextTab = Math.min(
6929
- state.activeIndex + 1,
6930
- state.questions.length - 1
6931
- );
6932
- return { ...nextState, activeIndex: nextTab };
6975
+ return askChoiceReducer(state, { type: "SELECT_CHOICE", choiceId });
6933
6976
  }
6934
6977
  case "FOCUS_OTHER": {
6935
6978
  const qs = state.questionStates[state.activeIndex];
@@ -6946,40 +6989,47 @@ function askChoiceReducer(state, action) {
6946
6989
  case "SET_OTHER_TEXT": {
6947
6990
  const qs = state.questionStates[state.activeIndex];
6948
6991
  const newQs = [...state.questionStates];
6949
- newQs[state.activeIndex] = { ...qs, otherText: action.text };
6950
- return { ...state, questionStates: newQs };
6992
+ const hasText = action.text.trim().length > 0;
6993
+ newQs[state.activeIndex] = {
6994
+ ...qs,
6995
+ otherText: action.text,
6996
+ // Non-empty Other is mutually exclusive with predefined choices
6997
+ ...hasText ? { pickedId: null, selectedIds: [] } : {}
6998
+ };
6999
+ return { ...state, questionStates: newQs, validationAttempted: false };
6951
7000
  }
6952
7001
  default:
6953
7002
  return state;
6954
7003
  }
6955
7004
  }
7005
+ function findFirstUnansweredIndex(state) {
7006
+ return state.questions.findIndex(
7007
+ (q, i) => !isQuestionAnswered(q, state.questionStates[i])
7008
+ );
7009
+ }
6956
7010
  function isQuestionAnswered(q, qs) {
6957
7011
  if (!q.required) return true;
6958
- const hasSelection = q.multiSelect ? qs.selectedIds.length > 0 : qs.pickedId !== null;
6959
7012
  const hasOther = q.allowOther && qs.otherText.trim().length > 0;
6960
- return hasSelection || hasOther;
6961
- }
6962
- function canSubmit(state) {
6963
- return state.questions.every(
6964
- (q, i) => isQuestionAnswered(q, state.questionStates[i])
6965
- );
7013
+ const hasSelection = q.multiSelect ? qs.selectedIds.length > 0 : qs.pickedId !== null;
7014
+ return hasOther || hasSelection;
6966
7015
  }
6967
7016
  function buildAskChoiceResult(state) {
6968
7017
  if (state.phase === "cancelled") return { kind: "cancelled" };
6969
7018
  if (state.phase !== "submitted") return { kind: "cancelled" };
6970
7019
  const answers = state.questions.map((q, i) => {
6971
7020
  const qs = state.questionStates[i];
6972
- const selectedIds = q.multiSelect ? qs.selectedIds : qs.pickedId ? [qs.pickedId] : [];
6973
7021
  const otherText = qs.otherText.trim();
7022
+ const selectedIds = otherText ? [] : q.multiSelect ? qs.selectedIds : qs.pickedId ? [qs.pickedId] : [];
6974
7023
  const parts = [];
6975
- for (const id of selectedIds) {
6976
- const choice = q.choices.find((c) => c.id === id);
6977
- if (choice) {
6978
- parts.push(choice.userMessage || choice.label);
6979
- }
6980
- }
6981
7024
  if (otherText) {
6982
7025
  parts.push(otherText);
7026
+ } else {
7027
+ for (const id of selectedIds) {
7028
+ const choice = q.choices.find((c) => c.id === id);
7029
+ if (choice) {
7030
+ parts.push(choice.userMessage || choice.label);
7031
+ }
7032
+ }
6983
7033
  }
6984
7034
  return {
6985
7035
  questionId: q.id,
@@ -6990,6 +7040,19 @@ function buildAskChoiceResult(state) {
6990
7040
  });
6991
7041
  return { kind: "submitted", answers };
6992
7042
  }
7043
+ function formatOutboundUserMessage(questions, answers) {
7044
+ if (answers.length <= 1) {
7045
+ return answers[0]?.userMessage ?? "";
7046
+ }
7047
+ return answers.map((a) => {
7048
+ const q = questions.find((item) => item.id === a.questionId);
7049
+ const title = q?.header || q?.question;
7050
+ if (title && a.userMessage) {
7051
+ return `[${title}]: ${a.userMessage}`;
7052
+ }
7053
+ return a.userMessage;
7054
+ }).filter(Boolean).join("\n\n");
7055
+ }
6993
7056
  function clamp(value, min, max) {
6994
7057
  return Math.max(min, Math.min(max, value));
6995
7058
  }
@@ -7000,10 +7063,17 @@ var KEY_SHIFT_TAB = "\x1B[Z";
7000
7063
  var KEY_BACKSPACE = "\x7F";
7001
7064
  var KEY_BACKSPACE_ALT = "\b";
7002
7065
  var KEY_SPACE = " ";
7003
- function renderTabBar(questions, activeIndex, colorEnabled) {
7004
- const tabs = questions.map((q, i) => {
7005
- const label = q.header || `Q${i + 1}`;
7006
- if (i === activeIndex) {
7066
+ var KEY_CTRL_S = "";
7067
+ var TAB_DONE = "\u2713";
7068
+ var TAB_MISSING = "!";
7069
+ var TAB_OPTIONAL = "\xB7";
7070
+ function renderTabBar(state, colorEnabled) {
7071
+ const tabs = state.questions.map((q, i) => {
7072
+ const qs = state.questionStates[i];
7073
+ const hasAnswer = qs.pickedId !== null || qs.selectedIds.length > 0 || qs.otherText.trim().length > 0;
7074
+ const mark = hasAnswer ? TAB_DONE : q.required ? TAB_MISSING : TAB_OPTIONAL;
7075
+ const label = `${mark} ${q.header || `Q${i + 1}`}`;
7076
+ if (i === state.activeIndex) {
7007
7077
  return colorEnabled ? `${themeColorSequence("accent")} ${label} \x1B[0m` : `[${label}]`;
7008
7078
  }
7009
7079
  return colorEnabled ? themeText(` ${label} `, "muted", colorEnabled) : ` ${label} `;
@@ -7020,6 +7090,7 @@ function otherRowPrefix(index) {
7020
7090
  }
7021
7091
  function renderAskChoiceFrame(state, options) {
7022
7092
  const colorEnabled = resolveCliColorEnabled();
7093
+ const submitFocused = options?.submitFocused === true;
7023
7094
  const q = state.questions[state.activeIndex];
7024
7095
  const qs = state.questionStates[state.activeIndex];
7025
7096
  const lines = [];
@@ -7032,7 +7103,13 @@ function renderAskChoiceFrame(state, options) {
7032
7103
  }
7033
7104
  lines.push("");
7034
7105
  if (state.questions.length > 1) {
7035
- lines.push(renderTabBar(state.questions, state.activeIndex, colorEnabled));
7106
+ lines.push(renderTabBar(state, colorEnabled));
7107
+ lines.push("");
7108
+ }
7109
+ if (state.validationAttempted) {
7110
+ lines.push(
7111
+ colorEnabled ? themeText(` ${t("askChoiceValidationRequired")}`, "warning", colorEnabled) : ` ${t("askChoiceValidationRequired")}`
7112
+ );
7036
7113
  lines.push("");
7037
7114
  }
7038
7115
  lines.push(
@@ -7059,7 +7136,7 @@ function renderAskChoiceFrame(state, options) {
7059
7136
  for (let i = window.start; i < window.end; i++) {
7060
7137
  if (i < q.choices.length) {
7061
7138
  const choice = q.choices[i];
7062
- const focused = qs.cursorIndex === i;
7139
+ const focused = qs.cursorIndex === i && !submitFocused;
7063
7140
  const checkbox = q.multiSelect ? qs.selectedIds.includes(choice.id) ? DIALOG_CHECKED : DIALOG_UNCHECKED : qs.pickedId === choice.id ? DIALOG_CHECKED : void 0;
7064
7141
  lines.push(
7065
7142
  renderDialogRow({
@@ -7070,7 +7147,7 @@ function renderAskChoiceFrame(state, options) {
7070
7147
  })
7071
7148
  );
7072
7149
  } else {
7073
- const focused = qs.cursorIndex === i;
7150
+ const focused = qs.cursorIndex === i && !submitFocused;
7074
7151
  const marker = focused ? DIALOG_CURSOR : " ";
7075
7152
  const plainPrefix = `${marker}${otherRowPrefix(i)}`;
7076
7153
  const plainRow = `${plainPrefix}${qs.otherText}`;
@@ -7092,6 +7169,12 @@ function renderAskChoiceFrame(state, options) {
7092
7169
  if (window.end < totalRows) {
7093
7170
  lines.push(renderOverflowBelow(totalRows - window.end));
7094
7171
  }
7172
+ lines.push(
7173
+ renderDialogRow({
7174
+ label: t("askChoiceSubmitRow"),
7175
+ focused: submitFocused
7176
+ })
7177
+ );
7095
7178
  lines.push("");
7096
7179
  lines.push(renderFooter(q.multiSelect, colorEnabled));
7097
7180
  return { text: lines.join("\n"), otherCursor };
@@ -7114,6 +7197,7 @@ async function runAskChoiceDialog(args) {
7114
7197
  const session = args.session ?? createStandaloneDialogSession({ input, output });
7115
7198
  const wheelThrottle = createWheelThrottle();
7116
7199
  let rawAcquired = false;
7200
+ let submitFocused = false;
7117
7201
  const bottomAnchored = Boolean(args.bottomAnchored && args.bottomRow);
7118
7202
  const resolveBottomRow = () => Math.max(
7119
7203
  1,
@@ -7122,7 +7206,7 @@ async function runAskChoiceDialog(args) {
7122
7206
  const painter = createDialogFramePainter({
7123
7207
  output,
7124
7208
  render: () => {
7125
- const frame = renderAskChoiceFrame(state, { bottomAnchored });
7209
+ const frame = renderAskChoiceFrame(state, { bottomAnchored, submitFocused });
7126
7210
  return {
7127
7211
  text: frame.text,
7128
7212
  cursor: frame.otherCursor
@@ -7164,6 +7248,7 @@ async function runAskChoiceDialog(args) {
7164
7248
  }
7165
7249
  const direction = scrollAction === "wheel-up" ? -1 : 1;
7166
7250
  if (wheelThrottle.step(direction) === 0) continue;
7251
+ submitFocused = false;
7167
7252
  state = askChoiceReducer(state, {
7168
7253
  type: "MOVE_CURSOR",
7169
7254
  delta: direction
@@ -7185,29 +7270,49 @@ async function runAskChoiceDialog(args) {
7185
7270
  } else if (isCancel(sequence)) {
7186
7271
  action = { type: "CANCEL" };
7187
7272
  } else if (isArrowUp(sequence)) {
7273
+ if (submitFocused) {
7274
+ submitFocused = false;
7275
+ paint();
7276
+ continue;
7277
+ }
7188
7278
  action = { type: "MOVE_CURSOR", delta: -1 };
7189
7279
  } else if (isArrowDown(sequence)) {
7280
+ const maxRowIndex = q.allowOther ? q.choices.length : q.choices.length - 1;
7281
+ if (submitFocused) {
7282
+ continue;
7283
+ }
7284
+ if (qs.cursorIndex >= maxRowIndex) {
7285
+ submitFocused = true;
7286
+ state = askChoiceReducer(state, { type: "MOVE_CURSOR", delta: 1 });
7287
+ paint();
7288
+ continue;
7289
+ }
7190
7290
  action = { type: "MOVE_CURSOR", delta: 1 };
7291
+ } else if (sequence === KEY_CTRL_S) {
7292
+ action = { type: "SUBMIT" };
7191
7293
  } else if (sequence === KEY_SPACE) {
7294
+ if (submitFocused) {
7295
+ continue;
7296
+ }
7192
7297
  if (qs.otherFocused) {
7193
7298
  action = {
7194
7299
  type: "SET_OTHER_TEXT",
7195
7300
  text: qs.otherText + " "
7196
7301
  };
7197
- } else if (q.multiSelect) {
7198
- action = { type: "TOGGLE_AT_CURSOR" };
7199
7302
  } else if (isOtherRow) {
7200
7303
  action = { type: "FOCUS_OTHER" };
7304
+ } else {
7305
+ action = { type: "TOGGLE_AT_CURSOR" };
7201
7306
  }
7202
7307
  } else if (isSubmit(sequence)) {
7203
- if (qs.otherFocused) {
7308
+ if (submitFocused) {
7309
+ action = { type: "SUBMIT" };
7310
+ } else if (qs.otherFocused) {
7204
7311
  action = { type: "BLUR_OTHER" };
7205
- } else if (isOtherRow && !qs.otherFocused) {
7312
+ } else if (isOtherRow) {
7206
7313
  action = { type: "FOCUS_OTHER" };
7207
- } else if (q.multiSelect) {
7208
- action = { type: "SUBMIT" };
7209
7314
  } else {
7210
- action = { type: "SELECT_AT_CURSOR" };
7315
+ action = { type: "TOGGLE_AT_CURSOR" };
7211
7316
  }
7212
7317
  } else if (sequence === KEY_BACKSPACE || sequence === KEY_BACKSPACE_ALT) {
7213
7318
  if (qs.otherFocused && qs.otherText.length > 0) {
@@ -7217,6 +7322,16 @@ async function runAskChoiceDialog(args) {
7217
7322
  text: chars.slice(0, -1).join("")
7218
7323
  };
7219
7324
  }
7325
+ } else if (submitFocused) {
7326
+ continue;
7327
+ } else if (sequence.length === 1 && sequence >= "1" && sequence <= "9" && !qs.otherFocused) {
7328
+ const rowIndex = Number(sequence) - 1;
7329
+ if (rowIndex < q.choices.length) {
7330
+ const choice = q.choices[rowIndex];
7331
+ if (choice) action = { type: "SELECT_CHOICE", choiceId: choice.id };
7332
+ } else if (rowIndex === q.choices.length && q.allowOther) {
7333
+ action = { type: "FOCUS_OTHER" };
7334
+ }
7220
7335
  } else if (sequence.length >= 1 && sequence.charCodeAt(0) >= 32 && !sequence.startsWith("\x1B")) {
7221
7336
  if (qs.otherFocused || isOtherRow && q.allowOther) {
7222
7337
  const cleaned = sequence.replace(/[\x00-\x1f\x7f]/g, "");
@@ -7235,10 +7350,7 @@ async function runAskChoiceDialog(args) {
7235
7350
  if (action) {
7236
7351
  state = askChoiceReducer(state, action);
7237
7352
  if (state.phase !== "active") break;
7238
- if (action.type === "BLUR_OTHER" && state.activeIndex >= state.questions.length - 1 && canSubmit(state)) {
7239
- state = askChoiceReducer(state, { type: "SUBMIT" });
7240
- break;
7241
- }
7353
+ submitFocused = false;
7242
7354
  paint();
7243
7355
  }
7244
7356
  }
@@ -7270,7 +7382,7 @@ async function runAskChoiceDialog(args) {
7270
7382
  return {
7271
7383
  kind: "multi-submitted",
7272
7384
  answers: result.answers,
7273
- userMessage: result.answers.map((a) => a.userMessage).filter(Boolean).join("\n\n")
7385
+ userMessage: formatOutboundUserMessage(normalized.questions, result.answers)
7274
7386
  };
7275
7387
  }
7276
7388
 
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  cleanupCliSessionForDialog
3
- } from "./chunk-76JAMDUT.js";
3
+ } from "./chunk-BJCWNHVU.js";
4
4
  import {
5
5
  getPrimaryDialogAgentId,
6
6
  removeDialogAgentId
@@ -13,20 +13,20 @@ import {
13
13
  } from "./chunk-M76ECQRD.js";
14
14
  import "./chunk-YDH3FDFQ.js";
15
15
  import "./chunk-W7XHHYWM.js";
16
- import "./chunk-OPNHMILE.js";
16
+ import "./chunk-XWNRAIUL.js";
17
17
  import "./chunk-Y5GCAMGP.js";
18
18
  import "./chunk-UZ6XXCVR.js";
19
19
  import "./chunk-KX6YBIHG.js";
20
20
  import {
21
21
  patch,
22
22
  selectById
23
- } from "./chunk-4K6DB3GJ.js";
23
+ } from "./chunk-YFADVSZE.js";
24
24
  import "./chunk-NHRQCXIQ.js";
25
25
  import "./chunk-WWC7I6TA.js";
26
26
  import "./chunk-I42VC5KR.js";
27
27
  import "./chunk-SREASRV5.js";
28
28
  import "./chunk-QSJ3HFEF.js";
29
- import "./chunk-4MKPBCTN.js";
29
+ import "./chunk-5J7W2VWW.js";
30
30
  import "./chunk-BJIRLHJR.js";
31
31
  import "./chunk-3RAG2NAD.js";
32
32
  import "./chunk-QOKAKDPE.js";