nolo-cli 0.14.0 → 0.16.0-alpha.1

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 (100) hide show
  1. package/{_executeModel-TURRLTZ2.js → _executeModel-QAUS6B7J.js} +24 -24
  2. package/{action-N3KXFO5V.js → action-GUOZYYGN.js} +4 -4
  3. package/{addContentAction-4Z762DMR.js → addContentAction-QDGHGUBH.js} +3 -3
  4. package/{addDialogAgentAction-FALLEKPR.js → addDialogAgentAction-Z4YCYZIV.js} +2 -2
  5. package/{agentDeleteCommand-AZDVM4HQ.js → agentDeleteCommand-365DMKHW.js} +20 -20
  6. package/{agentEmailCommands-M4AHOEZ3.js → agentEmailCommands-TQMXL36I.js} +38 -38
  7. package/{agentGrantCommands-B4MB23VQ.js → agentGrantCommands-JNDE4RWR.js} +2 -2
  8. package/{agentListCommands-OJLOXSKL.js → agentListCommands-6B5X4RC6.js} +22 -22
  9. package/{agentMachineCommands-NPMM4Z53.js → agentMachineCommands-LOEARB6V.js} +20 -20
  10. package/{agentPullCommand-KRBRIFIY.js → agentPullCommand-6HWUT3SW.js} +2 -2
  11. package/{agentRecordCommands-RVUH7XLZ.js → agentRecordCommands-DCH2WBL2.js} +33 -33
  12. package/{agentRunCommand-F6W2WKKZ.js → agentRunCommand-SGMH67WT.js} +35 -35
  13. package/{agentRunControl-IX4F5W2C.js → agentRunControl-6ADXVYMR.js} +2 -2
  14. package/{agentRuntimeLocal-DSUBT77I.js → agentRuntimeLocal-YSYZ33ER.js} +11 -11
  15. package/{agentSlice-PCEL26Z7.js → agentSlice-IVE735EV.js} +3 -3
  16. package/appDeleteCommands-6QYOO3JB.js +124 -0
  17. package/appDeployCommands-WTCT6XO6.js +163 -0
  18. package/appDeployStatusCommands-CGWGZJKB.js +144 -0
  19. package/appGetCommands-O4OCAMRW.js +119 -0
  20. package/appListCommands-UENFP4XY.js +122 -0
  21. package/{authCommand-66ME4KZX.js → authCommand-YFTR3347.js} +5 -5
  22. package/{authCommands-GH5T6RYV.js → authCommands-YXGOXNBZ.js} +3 -3
  23. package/{chunk-3B2LFO6R.js → browser-image-compression-MFDTD7K6.js} +4 -518
  24. package/{chunk-5R73BS7Y.js → chunk-4NLUNENX.js} +5 -5
  25. package/chunk-4QQFLN5C.js +552 -0
  26. package/{chunk-LNSRTNH7.js → chunk-6565R2TI.js} +20 -16
  27. package/{chunk-VQFY3VXW.js → chunk-6MHDWKOT.js} +3 -2
  28. package/{chunk-5NBHQD4D.js → chunk-A7GB5UGH.js} +1 -1
  29. package/{chunk-MYE5X27Y.js → chunk-BFRVXJJJ.js} +43 -16
  30. package/{chunk-XIDYAII4.js → chunk-E237VE6U.js} +7 -140
  31. package/{chunk-IYGQF62W.js → chunk-EMXI3N3Z.js} +3 -3
  32. package/{chunk-PYAJ6ZSK.js → chunk-G2MKOQCB.js} +1 -1
  33. package/chunk-GFUIQ4RY.js +136 -0
  34. package/{chunk-RZALKBP4.js → chunk-GRTFNYLR.js} +2 -2
  35. package/{chunk-KTFJUPDW.js → chunk-HRQCKQA5.js} +31 -31
  36. package/chunk-I66RU7P7.js +107 -0
  37. package/{chunk-OIMX7MM4.js → chunk-ISYE6GZB.js} +1 -1
  38. package/{chunk-4UUJFFMK.js → chunk-J55UHASN.js} +1 -1
  39. package/{chunk-V6VXDXGY.js → chunk-JS33TCQ3.js} +2 -2
  40. package/{chunk-7JJCGV7N.js → chunk-K6EUAOW3.js} +1 -1
  41. package/{chunk-OHEKYYJF.js → chunk-KMQPSTMJ.js} +6 -6
  42. package/{chunk-3WGLLTK4.js → chunk-LSFAWXKC.js} +100 -3
  43. package/{chunk-4ON5AV72.js → chunk-MYMMNKYL.js} +1 -1
  44. package/{chunk-BHK5ZAW7.js → chunk-N5424GSW.js} +1 -1
  45. package/{chunk-7LAIOHOL.js → chunk-O53CP2QR.js} +3 -3
  46. package/{chunk-IMZ7AFIJ.js → chunk-OQMPU2ML.js} +4 -4
  47. package/{chunk-NZFWHBW5.js → chunk-QLFCNUVQ.js} +496 -442
  48. package/{chunk-TQCONXQ3.js → chunk-QZVGMD5F.js} +1 -1
  49. package/{chunk-UW3WOIWJ.js → chunk-RKM3K52F.js} +1 -1
  50. package/{chunk-TLNEQI2R.js → chunk-RSYUDGGZ.js} +9 -9
  51. package/{chunk-A5V7UEZJ.js → chunk-SFXYKGK2.js} +3 -3
  52. package/{chunk-S5UACFUP.js → chunk-TTGAVETO.js} +10 -2
  53. package/{chunk-BOJVWKNA.js → chunk-U7LEGLEB.js} +1 -1
  54. package/{chunk-R5AOLZZV.js → chunk-VE6XMVKG.js} +203 -45
  55. package/{chunk-NJVPXLRY.js → chunk-VPTJB4HM.js} +1 -1
  56. package/{chunk-PB2DHBEQ.js → chunk-WA6KZL5V.js} +25 -6
  57. package/{chunk-T3X232L6.js → chunk-WNLPAOIT.js} +1 -1
  58. package/{chunk-E6KIDMTW.js → chunk-WPN6RMDF.js} +9 -9
  59. package/{chunk-NFPO7274.js → chunk-WRN5EQT7.js} +1 -1
  60. package/{chunk-3FCSMQAC.js → chunk-XVP3C2KY.js} +1 -1
  61. package/{chunk-33K5FKRL.js → chunk-YC3DJILJ.js} +111 -40
  62. package/{chunk-TYRTLSGX.js → chunk-YNHQIXX5.js} +833 -5746
  63. package/{chunk-4F4FJPFM.js → chunk-YYIRR6QC.js} +98 -209
  64. package/{chunk-7TN6V43T.js → chunk-Z24FGIU2.js} +2 -2
  65. package/{cliEnvHelpers-VYC2OPTB.js → cliEnvHelpers-ZXNMX7VV.js} +1 -1
  66. package/{createAgentAutomationAction-VLNDOHSP.js → createAgentAutomationAction-TS6NNZ4X.js} +9 -9
  67. package/{createDialogAction-6WYTS62Z.js → createDialogAction-5HVQ33EX.js} +10 -10
  68. package/{createPageAction-YKHOC3LW.js → createPageAction-4F3ZGQJD.js} +9 -9
  69. package/{dbSlice-7Q23HSWH.js → dbSlice-OP6UPXKA.js} +2 -2
  70. package/{dialogCommands-BQDGLVMO.js → dialogCommands-ZL6L24BS.js} +16 -16
  71. package/{dialogSlice-2A2JOFZW.js → dialogSlice-FAWUQDJW.js} +9 -9
  72. package/{docCreateCommands-K2MPMXYF.js → docCreateCommands-LYROQTFH.js} +22 -20
  73. package/{docDeleteCommands-NBAARB77.js → docDeleteCommands-6TWGTZNR.js} +21 -19
  74. package/{docReadCommands-S3MO5RPS.js → docReadCommands-PRULNF26.js} +20 -18
  75. package/{docStore-JJP5PUR7.js → docStore-2UHVWLTV.js} +10 -10
  76. package/{docUpdateCommands-EHEI7FCE.js → docUpdateCommands-NNYYWJBI.js} +21 -19
  77. package/{handleSendMessageAction-UAXTF73I.js → handleSendMessageAction-LJPUYNOH.js} +15 -11
  78. package/index.js +109 -78
  79. package/{machineCommands-BQ46IS5M.js → machineCommands-JQPEQFSE.js} +36 -36
  80. package/{machineWsRunDispatch-R33NXNNI.js → machineWsRunDispatch-FFFNWVEW.js} +32 -32
  81. package/{memoryCommands-AFMES3LN.js → memoryCommands-EBMICQR6.js} +1 -1
  82. package/package.json +1 -1
  83. package/{read-SIWMJRHC.js → read-HXHAZBKH.js} +1 -1
  84. package/{readDocTool-TCYJY4PP.js → readDocTool-VPBDTO4G.js} +1 -1
  85. package/{readlineWorkspace-KBG4DKLX.js → readlineWorkspace-QSXHSBHA.js} +211 -105
  86. package/{removeDialogAgentAction-WKHZT6VJ.js → removeDialogAgentAction-HUFVN35S.js} +4 -4
  87. package/{runAgentClientLoop-MUV5YIRK.js → runAgentClientLoop-A75BUU6D.js} +19 -19
  88. package/{runtimeDoctorCommands-QNF3J3UV.js → runtimeDoctorCommands-THIHX2SY.js} +1 -1
  89. package/{setDialogExtraReferencesAction-GCI5QU6E.js → setDialogExtraReferencesAction-2VLGWQKG.js} +2 -2
  90. package/{setPrimaryDialogAgentAction-NRO57AS6.js → setPrimaryDialogAgentAction-VB4UV2CC.js} +4 -4
  91. package/{settingSlice-FTWZ5ZHT.js → settingSlice-7JYPQNAC.js} +3 -3
  92. package/{spaceCommands-4R63UST3.js → spaceCommands-4LE45GB7.js} +21 -21
  93. package/{spaceSlice-VTC3QXP3.js → spaceSlice-444MFUP6.js} +11 -9
  94. package/{streamAgentChatTurn-43N7BNV2.js → streamAgentChatTurn-DJAE7USZ.js} +42 -39
  95. package/{tableCommands-E4SQWDOX.js → tableCommands-3P7MJ3PF.js} +4 -4
  96. package/{tools-PX6PEJLE.js → tools-YB6LXSVN.js} +14 -14
  97. package/{tuiSummaryLlmCaller-2D65LKWM.js → tuiSummaryLlmCaller-QQL3JA5I.js} +3 -3
  98. package/{updateCommands-XZDOOYFH.js → updateCommands-XTW55TOT.js} +2 -2
  99. package/{updateDialogTitleAction-NPQZWAKG.js → updateDialogTitleAction-6HGFBM64.js} +9 -9
  100. package/{chunk-3QAF2LTL.js → chunk-DZ3XJVET.js} +3 -3
@@ -4,15 +4,11 @@ import {
4
4
  refreshOpenAiCodexToken,
5
5
  refreshXaiOAuthToken
6
6
  } from "./chunk-EHLHSX7R.js";
7
- import {
8
- CliProviderQuotaError,
9
- executeCli
10
- } from "./chunk-CMKUBIGW.js";
11
7
  import {
12
8
  buildLocalAgentLookupKeys,
13
9
  normalizeAgentHandle,
14
10
  shouldReadAgentKeyRemotely
15
- } from "./chunk-TQCONXQ3.js";
11
+ } from "./chunk-QZVGMD5F.js";
16
12
  import {
17
13
  LOCAL_CODEX_AGENT_ID,
18
14
  LOCAL_CODEX_AGENT_KEY,
@@ -21,23 +17,21 @@ import {
21
17
  } from "./chunk-VHBWHNVT.js";
22
18
  import {
23
19
  inferCaptureIntent
24
- } from "./chunk-T3X232L6.js";
25
- import {
26
- buildCliPrompt
27
- } from "./chunk-ATNTHIZI.js";
20
+ } from "./chunk-WNLPAOIT.js";
28
21
  import {
29
22
  inlineImageUrlsForCustomProvider,
30
23
  prepareTools
31
- } from "./chunk-NFPO7274.js";
24
+ } from "./chunk-WRN5EQT7.js";
32
25
  import {
33
26
  getAntigravityUserAgent,
34
27
  isAntigravityOAuthAgent,
35
28
  readAntigravityProjectId,
36
29
  resolveAntigravityCloudCodeBaseUrl
37
- } from "./chunk-OIMX7MM4.js";
30
+ } from "./chunk-ISYE6GZB.js";
38
31
  import {
39
32
  FORCED_TOOLS,
40
33
  addDefaultLightWebToolsForConfiguredAgents,
34
+ addDefaultSystemCapabilityTools,
41
35
  appendEnabledPackPromptPatches,
42
36
  applyDisabledTools,
43
37
  applySystemBuiltinSkillFilter,
@@ -53,7 +47,7 @@ import {
53
47
  readXhsProfileFunctionSchema,
54
48
  rememberMemoryFunctionSchema,
55
49
  resolveEffectiveEnabledPacks
56
- } from "./chunk-R5AOLZZV.js";
50
+ } from "./chunk-VE6XMVKG.js";
57
51
  import {
58
52
  createDrainExhaustedResponse,
59
53
  isCoreDrainingBody,
@@ -65,13 +59,13 @@ import {
65
59
  } from "./chunk-OWOHNGCN.js";
66
60
  import {
67
61
  prepareTokenUsageData
68
- } from "./chunk-TYRTLSGX.js";
62
+ } from "./chunk-YNHQIXX5.js";
69
63
  import {
70
64
  BUILTIN_TITLE_LLM_CONFIG
71
65
  } from "./chunk-V2J635L5.js";
72
66
  import {
73
67
  fetchServerSyncedCredential
74
- } from "./chunk-IMZ7AFIJ.js";
68
+ } from "./chunk-OQMPU2ML.js";
75
69
  import {
76
70
  buildAgentRuntimeDialogWritePlan,
77
71
  buildLocalWorkspaceOpenAiTools,
@@ -84,7 +78,7 @@ import {
84
78
  parseSseDataLineJson,
85
79
  readOpenAiCompatibleSseCompletion,
86
80
  resolveOpenAiCompatibleProviderConfig
87
- } from "./chunk-33K5FKRL.js";
81
+ } from "./chunk-YC3DJILJ.js";
88
82
  import {
89
83
  buildPlatformChatCompletionRequest,
90
84
  canUsePlatformChatProvider,
@@ -94,14 +88,17 @@ import {
94
88
  resolveLegacyDeepSeekProxyChatFallback,
95
89
  resolvePlatformChatProviderConfig,
96
90
  shouldUsePlatformChatProvider
97
- } from "./chunk-PB2DHBEQ.js";
91
+ } from "./chunk-WA6KZL5V.js";
98
92
  import {
99
93
  resolveAgentRuntimeConfigFromRecord
100
94
  } from "./chunk-OIQPORYI.js";
101
95
  import {
102
96
  parseToolArgumentsJson,
103
97
  summarizeToolArguments
104
- } from "./chunk-VQFY3VXW.js";
98
+ } from "./chunk-6MHDWKOT.js";
99
+ import {
100
+ resolvePlatformAuthToken
101
+ } from "./chunk-HRQCKQA5.js";
105
102
  import {
106
103
  buildLoadSkillExecutor,
107
104
  buildNoloWorkspaceCliToolExecutors,
@@ -134,13 +131,27 @@ import {
134
131
  findRunRecord,
135
132
  listRunRecords,
136
133
  spawnLocalBackgroundRun
137
- } from "./chunk-4ON5AV72.js";
134
+ } from "./chunk-MYMMNKYL.js";
135
+ import {
136
+ CliProviderQuotaError,
137
+ executeCli
138
+ } from "./chunk-CMKUBIGW.js";
139
+ import {
140
+ buildCliPrompt
141
+ } from "./chunk-ATNTHIZI.js";
138
142
  import {
139
143
  toErrorMessage
140
144
  } from "./chunk-HNMXYYJR.js";
141
145
  import {
142
146
  getDefaultCliLocalRuntimeDb
143
147
  } from "./chunk-H33743XH.js";
148
+ import {
149
+ isCompiledBinary,
150
+ parseUserIdFromAuthToken
151
+ } from "./chunk-A7GB5UGH.js";
152
+ import {
153
+ DEFAULT_NOLO_SERVER_URL
154
+ } from "./chunk-OLZBQWZU.js";
144
155
  import {
145
156
  asRecordOrEmpty
146
157
  } from "./chunk-KX6YBIHG.js";
@@ -162,20 +173,13 @@ import {
162
173
  PUBLIC_GLM_52_AGENT_KEY,
163
174
  PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
164
175
  PUBLIC_KIMI_K27_CODING_AGENT_KEY
165
- } from "./chunk-NJVPXLRY.js";
176
+ } from "./chunk-VPTJB4HM.js";
166
177
  import {
167
178
  asTrimmedString
168
179
  } from "./chunk-3EUW3WEO.js";
169
180
  import {
170
181
  isRecord
171
182
  } from "./chunk-KUG52IAP.js";
172
- import {
173
- isCompiledBinary,
174
- parseUserIdFromAuthToken
175
- } from "./chunk-5NBHQD4D.js";
176
- import {
177
- DEFAULT_NOLO_SERVER_URL
178
- } from "./chunk-OLZBQWZU.js";
179
183
  import {
180
184
  NOLO_CLUSTER_SERVERS
181
185
  } from "./chunk-LCBAMY2M.js";
@@ -291,6 +295,10 @@ var STRINGS = {
291
295
  en: "Agent switch cancelled.",
292
296
  zh: "\u5DF2\u53D6\u6D88\u5207\u6362 agent\u3002"
293
297
  },
298
+ agentPickerLoading: {
299
+ en: "Loading agents\u2026",
300
+ zh: "\u6B63\u5728\u52A0\u8F7D agent \u5217\u8868\u2026"
301
+ },
294
302
  historyPickerTitle: {
295
303
  en: "Resume dialog (\u2191\u2193 Enter Esc)",
296
304
  zh: "\u6062\u590D\u5BF9\u8BDD\uFF08\u2191\u2193 \u79FB\u52A8 \xB7 Enter \u9009\u62E9 \xB7 Esc \u53D6\u6D88\uFF09"
@@ -610,10 +618,6 @@ var STRINGS = {
610
618
  en: "tools",
611
619
  zh: "\u5DE5\u5177"
612
620
  },
613
- contextFieldThinking: {
614
- en: "thinking",
615
- zh: "\u601D\u8003"
616
- },
617
621
  contextFieldServer: {
618
622
  en: "server",
619
623
  zh: "\u670D\u52A1\u7AEF"
@@ -651,7 +655,6 @@ var STRINGS = {
651
655
  " /context Show workspace context and next actions",
652
656
  " /runtime <mode> Use auto, local, or server runtime",
653
657
  " /tools <mode> Control tool trace: hide, compact, verbose",
654
- " /thinking <mode> Control thinking output: hide, marker, show",
655
658
  " /switch Pick an agent interactively (\u2191\u2193, Enter)",
656
659
  " /switch list List agents as text",
657
660
  " /switch <name> Switch directly by name, alias, or key (alias: /agent)",
@@ -688,7 +691,6 @@ var STRINGS = {
688
691
  " /context \u67E5\u770B\u5DE5\u4F5C\u533A\u4E0A\u4E0B\u6587\u4E0E\u540E\u7EED\u64CD\u4F5C",
689
692
  " /runtime <mode> \u5207\u6362 runtime\uFF1Aauto\u3001local\u3001server",
690
693
  " /tools <mode> \u5DE5\u5177\u8F68\u8FF9\u663E\u793A\uFF1Ahide\u3001compact\u3001verbose",
691
- " /thinking <mode> \u601D\u8003\u8FC7\u7A0B\u663E\u793A\uFF1Ahide\u3001marker\u3001show",
692
694
  " /switch \u4EA4\u4E92\u5F0F\u9009\u62E9 agent\uFF08\u2191\u2193 \u79FB\u52A8\uFF0CEnter \u786E\u8BA4\uFF09",
693
695
  " /switch list \u4EE5\u6587\u672C\u5217\u51FA\u5168\u90E8 agent",
694
696
  " /switch <name> \u6309\u540D\u79F0\u3001\u522B\u540D\u6216 key \u76F4\u63A5\u5207\u6362\uFF08\u522B\u540D\uFF1A/agent\uFF09",
@@ -733,12 +735,6 @@ var STRINGS = {
733
735
  },
734
736
  toolsUsage: { en: "Usage: /tools <hide|compact|verbose>", zh: "\u7528\u6CD5\uFF1A/tools <hide|compact|verbose>" },
735
737
  toolsSet: { en: "Tool display: {0}", zh: "\u5DE5\u5177\u663E\u793A\uFF1A{0}" },
736
- thinkingCurrent: {
737
- en: "Thinking display: {0} (hide | marker | show)",
738
- zh: "\u601D\u8003\u663E\u793A\uFF1A{0}\uFF08hide | marker | show\uFF09"
739
- },
740
- thinkingUsage: { en: "Usage: /thinking <hide|marker|show>", zh: "\u7528\u6CD5\uFF1A/thinking <hide|marker|show>" },
741
- thinkingSet: { en: "Thinking display: {0}", zh: "\u601D\u8003\u663E\u793A\uFF1A{0}" },
742
738
  tasksRunning: { en: "Running processes ({0}):", zh: "\u8FD0\u884C\u4E2D\u7684\u8FDB\u7A0B\uFF08{0}\uFF09\uFF1A" },
743
739
  tasksStopped: { en: "Stopped/exited ({0}):", zh: "\u5DF2\u505C\u6B62/\u5DF2\u9000\u51FA\uFF08{0}\uFF09\uFF1A" },
744
740
  tasksNone: { en: "No processes.", zh: "\u6CA1\u6709\u8FD0\u884C\u4E2D\u7684\u8FDB\u7A0B\u3002" },
@@ -768,8 +764,8 @@ Use /switch, /switch list, /switch minimax-m3, or a full agent key.`,
768
764
  },
769
765
  themeCurrent: { en: "Current theme: {0} \xB7 {1}", zh: "\u5F53\u524D\u4E3B\u9898\uFF1A{0} \xB7 {1}" },
770
766
  themeUsage: {
771
- en: "Usage: /theme <name> | /theme light | /theme dark",
772
- zh: "\u7528\u6CD5\uFF1A/theme <name> | /theme light | /theme dark"
767
+ en: "Usage: /theme <name> | /theme light | /theme dark | /theme refresh",
768
+ zh: "\u7528\u6CD5\uFF1A/theme <name> | /theme light | /theme dark | /theme refresh"
773
769
  },
774
770
  themeAvailable: { en: "Available themes: {0}", zh: "\u53EF\u7528\u4E3B\u9898\uFF1A{0}" },
775
771
  themeBrightnessSwitched: { en: "Switched to {0} background colors.", zh: "\u5DF2\u5207\u6362\u5230 {0} \u80CC\u666F\u8272\u3002" },
@@ -777,6 +773,14 @@ Use /switch, /switch list, /switch minimax-m3, or a full agent key.`,
777
773
  en: "Background colors follow terminal detection (now: {0}).",
778
774
  zh: "\u80CC\u666F\u8272\u8DDF\u968F\u7EC8\u7AEF\u81EA\u52A8\u68C0\u6D4B\uFF08\u5F53\u524D\uFF1A{0}\uFF09\u3002"
779
775
  },
776
+ themeRefreshed: {
777
+ en: "Re-detected terminal background: {0}.",
778
+ zh: "\u5DF2\u91CD\u65B0\u68C0\u6D4B\u7EC8\u7AEF\u80CC\u666F\uFF1A{0}\u3002"
779
+ },
780
+ themeRefreshFailed: {
781
+ en: "Could not detect terminal background (not a TTY or no response).",
782
+ zh: "\u65E0\u6CD5\u68C0\u6D4B\u7EC8\u7AEF\u80CC\u666F\uFF08\u975E TTY \u6216\u7EC8\u7AEF\u65E0\u54CD\u5E94\uFF09\u3002"
783
+ },
780
784
  themeSwitched: { en: "Switched to theme: {0}", zh: "\u5DF2\u5207\u6362\u5230\u4E3B\u9898\uFF1A{0}" },
781
785
  themeUnknown: { en: "Unknown theme: {0}. Available themes: {1}", zh: "\u672A\u77E5\u4E3B\u9898\uFF1A{0}\u3002\u53EF\u7528\u4E3B\u9898\uFF1A{1}" },
782
786
  densityCurrent: {
@@ -929,6 +933,44 @@ function agentRunCardLabels() {
929
933
  };
930
934
  }
931
935
 
936
+ // packages/cli/client/localRuntimeDiagnostics.ts
937
+ import { ulid } from "ulid";
938
+ var preparedAgentRuntimeCache = /* @__PURE__ */ new Map();
939
+ var hybridStoreCache = /* @__PURE__ */ new Map();
940
+ function normalizeRuntimeCacheCwd(cwd) {
941
+ return (cwd?.trim() || process.cwd()).replace(/\/+$/, "") || ".";
942
+ }
943
+ function buildPreparedAgentCacheKey(args) {
944
+ const systemBuiltinSkillsKey = args.systemBuiltinSkills ? JSON.stringify(
945
+ Object.keys(args.systemBuiltinSkills).sort().map((key) => [key, args.systemBuiltinSkills?.[key]])
946
+ ) : "default";
947
+ return `${args.userId}\0${args.agentRef}\0${args.cwd}\0${systemBuiltinSkillsKey}`;
948
+ }
949
+ function clearCliLocalRuntimePreparedAgentCache() {
950
+ preparedAgentRuntimeCache.clear();
951
+ hybridStoreCache.clear();
952
+ }
953
+ async function defaultLocalRuntimeDb() {
954
+ return getDefaultCliLocalRuntimeDb();
955
+ }
956
+ function createFallbackId() {
957
+ return ulid();
958
+ }
959
+ function logLocalRuntimeDiagnostic(event, fields) {
960
+ if (process.env.NOLO_LOCAL_RUNTIME_DEBUG !== "1" && process.env.NOLO_DEBUG !== "1") {
961
+ return;
962
+ }
963
+ console.error(`[nolo-local-runtime] ${event} ${JSON.stringify(fields)}`);
964
+ }
965
+ function summarizeOpenAiToolNames(tools) {
966
+ return tools.reduce((acc, tool) => {
967
+ const fn = tool.function;
968
+ const name = fn && typeof fn === "object" && "name" in fn && typeof fn.name === "string" ? fn.name : null;
969
+ if (name) acc.push(name);
970
+ return acc;
971
+ }, []);
972
+ }
973
+
932
974
  // packages/cli/client/localRuntimeAdapter.ts
933
975
  import { dirname, extname, join } from "node:path";
934
976
  import { fileURLToPath } from "node:url";
@@ -954,7 +996,7 @@ function resolveRuntimeServerUrl(env) {
954
996
  return (env?.NOLO_SERVER_URL || env?.NOLO_SERVER || env?.BASE_URL || "").replace(/\/+$/, "");
955
997
  }
956
998
  function resolveRuntimeAuthToken(env) {
957
- return env?.AUTH_TOKEN || env?.AUTH || env?.NOLO_MACHINE_API_KEY || "";
999
+ return resolvePlatformAuthToken(env ?? {});
958
1000
  }
959
1001
 
960
1002
  // packages/cli/client/localRuntimeFetchRetry.ts
@@ -1368,56 +1410,6 @@ async function syncLocalDialogEvidenceToRemote(args) {
1368
1410
  return { attempted: true };
1369
1411
  }
1370
1412
 
1371
- // packages/cli/client/cliChildDialogPersist.ts
1372
- async function persistCliPendingChildDialog(args) {
1373
- const nowIso = new Date(args.now).toISOString();
1374
- const dialogKey = `dialog-${args.userId}-${args.dialogId}`;
1375
- const record = {
1376
- id: args.dialogId,
1377
- dbKey: dialogKey,
1378
- type: "dialog",
1379
- userId: args.userId,
1380
- cybots: [args.agentKey],
1381
- primaryAgentKey: args.agentKey,
1382
- title: args.title.slice(0, 80),
1383
- status: "pending",
1384
- triggerType: "cli-local",
1385
- executionMode: args.background ? "background" : "foreground",
1386
- createdAt: nowIso,
1387
- updatedAt: nowIso,
1388
- ...args.spaceId ? { spaceId: args.spaceId } : {},
1389
- ...args.parentDialogId ? { parentDialogId: args.parentDialogId } : {},
1390
- ...args.rootDialogId ? { rootDialogId: args.rootDialogId } : {},
1391
- localRuntime: {
1392
- host: "cli",
1393
- workspaceRoot: args.workspaceRoot,
1394
- workspaceKind: "current",
1395
- workspaceAccess: "inherited"
1396
- }
1397
- };
1398
- await args.store.batch([{ type: "put", key: dialogKey, value: record }]);
1399
- }
1400
- async function persistCliFailedChildDialog(args) {
1401
- const dialogKey = `dialog-${args.userId}-${args.dialogId}`;
1402
- const existing = await args.store.read(dialogKey);
1403
- const existingRecord = existing && typeof existing === "object" ? existing : {};
1404
- await args.store.batch([
1405
- {
1406
- type: "put",
1407
- key: dialogKey,
1408
- value: {
1409
- ...existingRecord,
1410
- id: args.dialogId,
1411
- dbKey: dialogKey,
1412
- status: "failed",
1413
- errorMessage: args.errorMessage,
1414
- updatedAt: new Date(args.now).toISOString(),
1415
- finishedAt: args.now
1416
- }
1417
- }
1418
- ]);
1419
- }
1420
-
1421
1413
  // packages/cli/client/cliLocalToolBudget.ts
1422
1414
  function parseLocalToolBudgets(env) {
1423
1415
  const raw = env.NOLO_LOCAL_TOOL_BUDGETS?.trim();
@@ -1637,58 +1629,6 @@ async function readDialogMessages(args) {
1637
1629
  return messages;
1638
1630
  }
1639
1631
 
1640
- // packages/cli/client/cliWorkspaceToolVariants.ts
1641
- function shouldUseDeclaredOnlyLocalWorkspaceTools(env) {
1642
- const value = env.NOLO_LOCAL_WORKSPACE_TOOLSET || env.NOLO_LOCAL_TOOLSET_MODE || "";
1643
- return value === "declared-only" || value === "declared";
1644
- }
1645
- function resolveGlobFilesDescriptionVariant(env) {
1646
- return resolveLocalWorkspaceDescriptionVariant(
1647
- env.NOLO_GLOBFILES_DESCRIPTION_VARIANT
1648
- );
1649
- }
1650
- function resolveListFilesDescriptionVariant(env) {
1651
- return resolveLocalWorkspaceDescriptionVariant(
1652
- env.NOLO_LISTFILES_DESCRIPTION_VARIANT
1653
- );
1654
- }
1655
- function resolveListFilesParameterVariant(env) {
1656
- return resolveLocalWorkspaceParameterVariant(
1657
- env.NOLO_LISTFILES_PARAMETER_VARIANT
1658
- );
1659
- }
1660
- function resolveReadFileDescriptionVariant(env) {
1661
- return resolveLocalWorkspaceDescriptionVariant(
1662
- env.NOLO_READFILE_DESCRIPTION_VARIANT
1663
- );
1664
- }
1665
- function resolveReadFileParameterVariant(env) {
1666
- return resolveLocalWorkspaceParameterVariant(
1667
- env.NOLO_READFILE_PARAMETER_VARIANT
1668
- );
1669
- }
1670
- function resolveGlobFilesParameterVariant(env) {
1671
- return resolveLocalWorkspaceParameterVariant(
1672
- env.NOLO_GLOBFILES_PARAMETER_VARIANT
1673
- );
1674
- }
1675
- function resolveSearchFilesDescriptionVariant(env) {
1676
- return resolveLocalWorkspaceDescriptionVariant(
1677
- env.NOLO_SEARCHFILES_DESCRIPTION_VARIANT
1678
- );
1679
- }
1680
- function resolveSearchFilesParameterVariant(env) {
1681
- return resolveLocalWorkspaceParameterVariant(
1682
- env.NOLO_SEARCHFILES_PARAMETER_VARIANT
1683
- );
1684
- }
1685
- function resolveLocalWorkspaceDescriptionVariant(value) {
1686
- return value === "brief" || value === "strategy" || value === "workflow" || value === "antiShell" ? value : "strategy";
1687
- }
1688
- function resolveLocalWorkspaceParameterVariant(value) {
1689
- return value === "minimal" || value === "scoped" || value === "rich" ? value : "rich";
1690
- }
1691
-
1692
1632
  // packages/cli/client/cliProviderHelpers.ts
1693
1633
  function buildDelegatedTaskContent(task, input) {
1694
1634
  if (input === void 0 || input === null) {
@@ -2541,6 +2481,24 @@ function convertOpenAiMessagesToCca(messages, options) {
2541
2481
  const contents = [];
2542
2482
  const systemTexts = [];
2543
2483
  const toolNamesById = /* @__PURE__ */ new Map();
2484
+ let pendingFunctionCalls = [];
2485
+ const pushOrMergeContent = (role, parts) => {
2486
+ if (parts.length === 0) return;
2487
+ const last = contents[contents.length - 1];
2488
+ if (last && last.role === role) {
2489
+ last.parts.push(...parts);
2490
+ } else {
2491
+ contents.push({ role, parts });
2492
+ }
2493
+ };
2494
+ const flushPendingFunctionCalls = () => {
2495
+ if (pendingFunctionCalls.length === 0) return;
2496
+ const dummyResponses = pendingFunctionCalls.map(({ name }) => ({
2497
+ functionResponse: { name, response: { output: "{}" } }
2498
+ }));
2499
+ pendingFunctionCalls = [];
2500
+ pushOrMergeContent("user", dummyResponses);
2501
+ };
2544
2502
  for (const raw of messages) {
2545
2503
  if (!raw || typeof raw !== "object" || !("role" in raw)) continue;
2546
2504
  const role = String(raw.role);
@@ -2551,6 +2509,7 @@ function convertOpenAiMessagesToCca(messages, options) {
2551
2509
  continue;
2552
2510
  }
2553
2511
  if (role === "user") {
2512
+ flushPendingFunctionCalls();
2554
2513
  const text = messageText(content);
2555
2514
  const imageParts = extractInlineDataParts(
2556
2515
  content
@@ -2559,10 +2518,11 @@ function convertOpenAiMessagesToCca(messages, options) {
2559
2518
  const parts = [];
2560
2519
  if (text) parts.push({ text });
2561
2520
  for (const img of imageParts) parts.push(img);
2562
- contents.push({ role: "user", parts });
2521
+ pushOrMergeContent("user", parts);
2563
2522
  continue;
2564
2523
  }
2565
2524
  if (role === "assistant") {
2525
+ flushPendingFunctionCalls();
2566
2526
  const parts = [];
2567
2527
  const text = messageText(content);
2568
2528
  if (text) parts.push({ text });
@@ -2572,6 +2532,7 @@ function convertOpenAiMessagesToCca(messages, options) {
2572
2532
  if (!name) continue;
2573
2533
  const id = call.id?.trim() || `${name}_${toolNamesById.size}`;
2574
2534
  toolNamesById.set(id, name);
2535
+ pendingFunctionCalls.push({ name, id });
2575
2536
  const realSignature = typeof call.thought_signature === "string" && call.thought_signature ? call.thought_signature : void 0;
2576
2537
  const isFirstFunctionCallPart = !parts.some((p) => "functionCall" in p);
2577
2538
  parts.push({
@@ -2584,19 +2545,28 @@ function convertOpenAiMessagesToCca(messages, options) {
2584
2545
  });
2585
2546
  }
2586
2547
  if (parts.length === 0) continue;
2587
- contents.push({ role: "model", parts });
2548
+ pushOrMergeContent("model", parts);
2588
2549
  continue;
2589
2550
  }
2590
2551
  if (role === "tool") {
2591
2552
  const toolCallId = "tool_call_id" in raw && typeof raw.tool_call_id === "string" ? raw.tool_call_id : "";
2592
- const name = toolNamesById.get(toolCallId) ?? "tool";
2553
+ const rawName = "name" in raw && typeof raw.name === "string" ? raw.name.trim() : "";
2554
+ const name = toolNamesById.get(toolCallId) || rawName || pendingFunctionCalls[0]?.name || "tool";
2555
+ const pendingIndex = pendingFunctionCalls.findIndex(
2556
+ (p) => toolCallId ? p.id === toolCallId : p.name === name
2557
+ );
2558
+ if (pendingIndex !== -1) {
2559
+ pendingFunctionCalls.splice(pendingIndex, 1);
2560
+ } else if (pendingFunctionCalls.length > 0) {
2561
+ pendingFunctionCalls.shift();
2562
+ }
2593
2563
  const output = messageText(content) || "{}";
2594
- contents.push({
2595
- role: "user",
2596
- parts: [{ functionResponse: { name, response: { output } } }]
2597
- });
2564
+ pushOrMergeContent("user", [
2565
+ { functionResponse: { name, response: { output } } }
2566
+ ]);
2598
2567
  }
2599
2568
  }
2569
+ flushPendingFunctionCalls();
2600
2570
  return { contents, systemTexts };
2601
2571
  }
2602
2572
  function convertOpenAiTools(tools) {
@@ -9121,6 +9091,30 @@ function createOAuthApiKeyRefResolver(options = {}) {
9121
9091
  };
9122
9092
  }
9123
9093
 
9094
+ // packages/cli/client/hybridRecordStore.ts
9095
+ function resolveFallbackServers(env) {
9096
+ const values = [
9097
+ env.NOLO_SERVER_URL,
9098
+ env.BASE_URL,
9099
+ ...NOLO_CLUSTER_SERVERS
9100
+ ].filter((value) => typeof value === "string" && value.trim().length > 0);
9101
+ return [...new Set(values.map(normalizeServerOrigin))];
9102
+ }
9103
+ function resolveAuthToken(env) {
9104
+ return resolvePlatformAuthToken(env);
9105
+ }
9106
+ function createCliHybridRecordStore(deps) {
9107
+ return createHybridRecordStore({
9108
+ db: deps.db,
9109
+ defaultServer: normalizeServerOrigin(
9110
+ deps.env.NOLO_SERVER || deps.env.BASE_URL || DEFAULT_NOLO_SERVER_URL
9111
+ ),
9112
+ fallbackServers: resolveFallbackServers(deps.env),
9113
+ authToken: resolveAuthToken(deps.env),
9114
+ fetchImpl: deps.fetchImpl
9115
+ });
9116
+ }
9117
+
9124
9118
  // packages/agent-runtime/dialogTitleLlm.ts
9125
9119
  async function generateLocalDialogTitle(input) {
9126
9120
  const { env, messages, fallbackTitle } = input;
@@ -9189,73 +9183,315 @@ function safeParseJson(raw) {
9189
9183
  }
9190
9184
  }
9191
9185
 
9192
- // packages/cli/client/hybridRecordStore.ts
9193
- function resolveFallbackServers(env) {
9194
- const values = [
9195
- env.NOLO_SERVER_URL,
9196
- env.BASE_URL,
9197
- ...NOLO_CLUSTER_SERVERS
9198
- ].filter((value) => typeof value === "string" && value.trim().length > 0);
9199
- return [...new Set(values.map(normalizeServerOrigin))];
9200
- }
9201
- function resolveAuthToken(env) {
9202
- return env.AUTH_TOKEN || env.AUTH || env.BENCHMARK_AUTH_TOKEN || "";
9203
- }
9204
- function createCliHybridRecordStore(deps) {
9205
- return createHybridRecordStore({
9206
- db: deps.db,
9207
- defaultServer: normalizeServerOrigin(
9208
- deps.env.NOLO_SERVER || deps.env.BASE_URL || DEFAULT_NOLO_SERVER_URL
9209
- ),
9210
- fallbackServers: resolveFallbackServers(deps.env),
9211
- authToken: resolveAuthToken(deps.env),
9186
+ // packages/cli/client/localRuntimeDialog.ts
9187
+ async function resolveStore(deps) {
9188
+ if (deps.store) return deps.store;
9189
+ return createCliHybridRecordStore({
9190
+ db: deps.db ?? await defaultLocalRuntimeDb(),
9191
+ env: deps.env,
9212
9192
  fetchImpl: deps.fetchImpl
9213
9193
  });
9214
9194
  }
9215
-
9216
- // packages/cli/client/localRuntimeAdapter.ts
9217
- import { ulid } from "ulid";
9218
- var resolveRuntimeAuthToken2 = resolveRuntimeAuthToken;
9219
- var currentMetaFile = fileURLToPath(import.meta.url);
9220
- var isJsBundle = extname(currentMetaFile) === ".js";
9221
- var SOURCE_CLI_DIR = isJsBundle ? dirname(currentMetaFile) : dirname(dirname(currentMetaFile));
9222
- var CLI_DIR = isCompiledBinary() ? dirname(process.execPath) : SOURCE_CLI_DIR;
9223
- var CLI_ENTRYPOINT = isCompiledBinary() ? process.execPath : isJsBundle ? currentMetaFile : join(SOURCE_CLI_DIR, "index.ts");
9224
- var preparedAgentRuntimeCache = /* @__PURE__ */ new Map();
9225
- var hybridStoreCache = /* @__PURE__ */ new Map();
9226
- function normalizeRuntimeCacheCwd(cwd) {
9227
- return (cwd?.trim() || process.cwd()).replace(/\/+$/, "") || ".";
9228
- }
9229
- function buildPreparedAgentCacheKey(args) {
9230
- const systemBuiltinSkillsKey = args.systemBuiltinSkills ? JSON.stringify(
9231
- Object.keys(args.systemBuiltinSkills).sort().map((key) => [key, args.systemBuiltinSkills?.[key]])
9232
- ) : "default";
9233
- return `${args.userId}\0${args.agentRef}\0${args.cwd}\0${systemBuiltinSkillsKey}`;
9195
+ async function getOrCreateSharedStore(deps) {
9196
+ if (deps.store) return deps.store;
9197
+ const cacheKey = normalizeRuntimeCacheCwd(deps.cwd);
9198
+ let storePromise = hybridStoreCache.get(cacheKey);
9199
+ if (!storePromise) {
9200
+ storePromise = resolveStore(deps);
9201
+ hybridStoreCache.set(cacheKey, storePromise);
9202
+ }
9203
+ return storePromise;
9234
9204
  }
9235
- function clearCliLocalRuntimePreparedAgentCache() {
9236
- preparedAgentRuntimeCache.clear();
9237
- hybridStoreCache.clear();
9205
+ function createLocalDialogTitleGenerator(deps, ctx) {
9206
+ return async (input) => {
9207
+ if (!canUsePlatformChatProvider(deps.env)) {
9208
+ return null;
9209
+ }
9210
+ const result = await generateLocalDialogTitle({
9211
+ messages: input.messages,
9212
+ env: deps.env,
9213
+ fetchImpl: async (url, init) => fetchWithTransientRetry(
9214
+ deps.fetchImpl ?? fetch,
9215
+ url,
9216
+ init,
9217
+ {
9218
+ sleep: deps.sleep,
9219
+ loopbackRequest: ctx.loopbackRequest
9220
+ }
9221
+ ),
9222
+ resolveProviderConfig: async (args) => resolvePlatformChatProviderConfig({
9223
+ agentConfig: args.agentConfig,
9224
+ env: args.env,
9225
+ apiKeyRefResolver: ctx.apiKeyRefResolver,
9226
+ credentialBroker: ctx.credentialBroker
9227
+ }),
9228
+ buildRequest: (args) => buildPlatformChatCompletionRequest({
9229
+ providerConfig: args.providerConfig,
9230
+ messages: args.messages,
9231
+ stream: false
9232
+ }),
9233
+ parseResponse: (args) => parsePlatformChatCompletionResponse({
9234
+ providerConfig: args.providerConfig,
9235
+ data: args.data,
9236
+ trace: []
9237
+ }),
9238
+ fallbackTitle: input.fallbackTitle,
9239
+ timeoutMs: 15e3
9240
+ });
9241
+ return result.source === "llm" ? result.title : null;
9242
+ };
9238
9243
  }
9239
- async function defaultLocalRuntimeDb() {
9240
- return getDefaultCliLocalRuntimeDb();
9244
+ async function writeLocalTokenRecord(args) {
9245
+ const rawUsage = args.input.result.usage;
9246
+ if (!rawUsage || typeof rawUsage !== "object" || Object.keys(rawUsage).length === 0) {
9247
+ return;
9248
+ }
9249
+ const timestamp = args.now();
9250
+ const prepared = prepareTokenUsageData({
9251
+ rawUsage,
9252
+ agentConfig: {
9253
+ model: args.input.result.model || "unknown",
9254
+ provider: args.input.result.provider,
9255
+ apiSource: "cli"
9256
+ },
9257
+ userId: args.userId,
9258
+ agentId: args.input.agentKey,
9259
+ dialogId: args.dialogId,
9260
+ timestamp,
9261
+ entry_path: "cli-local"
9262
+ });
9263
+ const recordKey = createTokenKey.record(args.userId, timestamp);
9264
+ const tokenRecord = {
9265
+ id: args.createId(),
9266
+ type: "token",
9267
+ ...prepared.tokenData
9268
+ };
9269
+ await args.store.write(recordKey, tokenRecord);
9241
9270
  }
9242
- function createFallbackId() {
9243
- return ulid();
9271
+ async function writeDialog(args) {
9272
+ let existingDialog = null;
9273
+ if (args.input.continueDialogId) {
9274
+ const dialogKey = `dialog-${args.userId}-${args.input.continueDialogId}`;
9275
+ existingDialog = await args.store.read(dialogKey);
9276
+ }
9277
+ const authToken = resolveRuntimeAuthToken(args.env);
9278
+ const isLoggedIn = Boolean(
9279
+ authToken && (parseUserIdFromAuthToken(authToken) || args.env.NOLO_MACHINE_API_KEY?.trim())
9280
+ );
9281
+ const hasExistingTitle = typeof existingDialog?.title === "string" && existingDialog.title.trim();
9282
+ let titleOverride;
9283
+ if (isLoggedIn && !hasExistingTitle && args.titleGenerator) {
9284
+ const fallbackTitle = extractLastUserText(args.input.messages).trim().slice(0, 80) || "Local agent run";
9285
+ try {
9286
+ const generated = await args.titleGenerator({
9287
+ messages: args.input.messages,
9288
+ fallbackTitle
9289
+ });
9290
+ if (generated) {
9291
+ titleOverride = generated;
9292
+ }
9293
+ } catch {
9294
+ }
9295
+ }
9296
+ const plan = buildLocalDialogWritePlan({
9297
+ input: args.input,
9298
+ userId: args.userId,
9299
+ now: args.now(),
9300
+ createId: args.createId,
9301
+ existingDialog,
9302
+ cwd: args.cwd,
9303
+ ...titleOverride ? { titleOverride } : {}
9304
+ });
9305
+ await args.store.batch(plan.ops);
9306
+ try {
9307
+ await writeLocalTokenRecord({
9308
+ store: args.store,
9309
+ input: args.input,
9310
+ userId: args.userId,
9311
+ dialogId: plan.dialogId,
9312
+ now: args.now,
9313
+ createId: args.createId,
9314
+ output: args.output
9315
+ });
9316
+ } catch (error) {
9317
+ args.output?.write(
9318
+ `[nolo] Token usage record write failed (non-fatal): ${toErrorMessage(error)}
9319
+ `
9320
+ );
9321
+ }
9322
+ const hasSubjectRefs = localTurnHasSubjectRefs(args.input);
9323
+ const isLocalUser = args.userId === "local";
9324
+ if (!isLocalUser) {
9325
+ try {
9326
+ const syncResult = await syncLocalDialogEvidenceToRemote({
9327
+ env: args.env,
9328
+ fetchImpl: args.fetchImpl,
9329
+ input: args.input,
9330
+ ops: plan.ops,
9331
+ output: args.output,
9332
+ userId: args.userId
9333
+ });
9334
+ if (!syncResult.attempted) {
9335
+ if (hasSubjectRefs) {
9336
+ args.output?.write(
9337
+ "[nolo] Local dialog evidence is local-only; set NOLO_SERVER and AUTH_TOKEN to make subjectRefs remotely queryable.\n"
9338
+ );
9339
+ }
9340
+ }
9341
+ } catch (error) {
9342
+ if (hasSubjectRefs) {
9343
+ throw error;
9344
+ }
9345
+ args.output?.write(
9346
+ `[nolo] Remote dialog evidence sync failed; local dialog only: ${toErrorMessage(
9347
+ error
9348
+ )}
9349
+ `
9350
+ );
9351
+ }
9352
+ }
9353
+ return { dialogId: plan.dialogId, title: plan.title };
9244
9354
  }
9245
- function logLocalRuntimeDiagnostic(event, fields) {
9246
- if (process.env.NOLO_LOCAL_RUNTIME_DEBUG !== "1" && process.env.NOLO_DEBUG !== "1") {
9247
- return;
9355
+ function resolveCliDialogRecordKey(userId, dialogId) {
9356
+ if (dialogId.startsWith("dialog-") && !dialogId.includes("-msg-")) {
9357
+ return dialogId;
9248
9358
  }
9249
- console.error(`[nolo-local-runtime] ${event} ${JSON.stringify(fields)}`);
9359
+ return `dialog-${userId}-${dialogId}`;
9250
9360
  }
9251
- function summarizeOpenAiToolNames(tools) {
9252
- return tools.reduce((acc, tool) => {
9253
- const fn = tool.function;
9254
- const name = fn && typeof fn === "object" && "name" in fn && typeof fn.name === "string" ? fn.name : null;
9255
- if (name) acc.push(name);
9256
- return acc;
9257
- }, []);
9361
+ async function loadCliDialogSummary(args) {
9362
+ const dialogKey = resolveCliDialogRecordKey(args.userId, args.dialogId);
9363
+ const record = await args.store.read(dialogKey);
9364
+ if (!record || typeof record !== "object") return null;
9365
+ const summary = typeof record.summary === "string" ? record.summary.trim() : "";
9366
+ if (!summary) return null;
9367
+ const summarizedBeforeId = record.summarizedBeforeId;
9368
+ return {
9369
+ summary,
9370
+ ...typeof summarizedBeforeId === "string" && summarizedBeforeId ? { summarizedBeforeId } : {}
9371
+ };
9372
+ }
9373
+ async function saveCliDialogSummary(args) {
9374
+ const dialogKey = resolveCliDialogRecordKey(args.userId, args.dialogId);
9375
+ const existing = await args.store.read(dialogKey) ?? {};
9376
+ const bareId = typeof existing.id === "string" && existing.id ? existing.id : args.dialogId.startsWith("dialog-") ? args.dialogId.slice(args.dialogId.lastIndexOf("-") + 1) : args.dialogId;
9377
+ const compressionCount = typeof existing.compressionCount === "number" ? existing.compressionCount + 1 : 1;
9378
+ await args.store.write(dialogKey, {
9379
+ ...existing,
9380
+ id: bareId,
9381
+ dbKey: dialogKey,
9382
+ type: "dialog",
9383
+ userId: args.userId,
9384
+ summary: args.summary,
9385
+ ...args.summarizedBeforeId !== void 0 ? { summarizedBeforeId: args.summarizedBeforeId } : {},
9386
+ compressionCount,
9387
+ summaryPending: false,
9388
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
9389
+ });
9258
9390
  }
9391
+
9392
+ // packages/cli/client/cliWorkspaceToolVariants.ts
9393
+ function shouldUseDeclaredOnlyLocalWorkspaceTools(env) {
9394
+ const value = env.NOLO_LOCAL_WORKSPACE_TOOLSET || env.NOLO_LOCAL_TOOLSET_MODE || "";
9395
+ return value === "declared-only" || value === "declared";
9396
+ }
9397
+ function resolveGlobFilesDescriptionVariant(env) {
9398
+ return resolveLocalWorkspaceDescriptionVariant(
9399
+ env.NOLO_GLOBFILES_DESCRIPTION_VARIANT
9400
+ );
9401
+ }
9402
+ function resolveListFilesDescriptionVariant(env) {
9403
+ return resolveLocalWorkspaceDescriptionVariant(
9404
+ env.NOLO_LISTFILES_DESCRIPTION_VARIANT
9405
+ );
9406
+ }
9407
+ function resolveListFilesParameterVariant(env) {
9408
+ return resolveLocalWorkspaceParameterVariant(
9409
+ env.NOLO_LISTFILES_PARAMETER_VARIANT
9410
+ );
9411
+ }
9412
+ function resolveReadFileDescriptionVariant(env) {
9413
+ return resolveLocalWorkspaceDescriptionVariant(
9414
+ env.NOLO_READFILE_DESCRIPTION_VARIANT
9415
+ );
9416
+ }
9417
+ function resolveReadFileParameterVariant(env) {
9418
+ return resolveLocalWorkspaceParameterVariant(
9419
+ env.NOLO_READFILE_PARAMETER_VARIANT
9420
+ );
9421
+ }
9422
+ function resolveGlobFilesParameterVariant(env) {
9423
+ return resolveLocalWorkspaceParameterVariant(
9424
+ env.NOLO_GLOBFILES_PARAMETER_VARIANT
9425
+ );
9426
+ }
9427
+ function resolveSearchFilesDescriptionVariant(env) {
9428
+ return resolveLocalWorkspaceDescriptionVariant(
9429
+ env.NOLO_SEARCHFILES_DESCRIPTION_VARIANT
9430
+ );
9431
+ }
9432
+ function resolveSearchFilesParameterVariant(env) {
9433
+ return resolveLocalWorkspaceParameterVariant(
9434
+ env.NOLO_SEARCHFILES_PARAMETER_VARIANT
9435
+ );
9436
+ }
9437
+ function resolveLocalWorkspaceDescriptionVariant(value) {
9438
+ return value === "brief" || value === "strategy" || value === "workflow" || value === "antiShell" ? value : "strategy";
9439
+ }
9440
+ function resolveLocalWorkspaceParameterVariant(value) {
9441
+ return value === "minimal" || value === "scoped" || value === "rich" ? value : "rich";
9442
+ }
9443
+
9444
+ // packages/cli/client/cliChildDialogPersist.ts
9445
+ async function persistCliPendingChildDialog(args) {
9446
+ const nowIso = new Date(args.now).toISOString();
9447
+ const dialogKey = `dialog-${args.userId}-${args.dialogId}`;
9448
+ const record = {
9449
+ id: args.dialogId,
9450
+ dbKey: dialogKey,
9451
+ type: "dialog",
9452
+ userId: args.userId,
9453
+ cybots: [args.agentKey],
9454
+ primaryAgentKey: args.agentKey,
9455
+ title: args.title.slice(0, 80),
9456
+ status: "pending",
9457
+ triggerType: "cli-local",
9458
+ executionMode: args.background ? "background" : "foreground",
9459
+ createdAt: nowIso,
9460
+ updatedAt: nowIso,
9461
+ ...args.spaceId ? { spaceId: args.spaceId } : {},
9462
+ ...args.parentDialogId ? { parentDialogId: args.parentDialogId } : {},
9463
+ ...args.rootDialogId ? { rootDialogId: args.rootDialogId } : {},
9464
+ localRuntime: {
9465
+ host: "cli",
9466
+ workspaceRoot: args.workspaceRoot,
9467
+ workspaceKind: "current",
9468
+ workspaceAccess: "inherited"
9469
+ }
9470
+ };
9471
+ await args.store.batch([{ type: "put", key: dialogKey, value: record }]);
9472
+ }
9473
+ async function persistCliFailedChildDialog(args) {
9474
+ const dialogKey = `dialog-${args.userId}-${args.dialogId}`;
9475
+ const existing = await args.store.read(dialogKey);
9476
+ const existingRecord = existing && typeof existing === "object" ? existing : {};
9477
+ await args.store.batch([
9478
+ {
9479
+ type: "put",
9480
+ key: dialogKey,
9481
+ value: {
9482
+ ...existingRecord,
9483
+ id: args.dialogId,
9484
+ dbKey: dialogKey,
9485
+ status: "failed",
9486
+ errorMessage: args.errorMessage,
9487
+ updatedAt: new Date(args.now).toISOString(),
9488
+ finishedAt: args.now
9489
+ }
9490
+ }
9491
+ ]);
9492
+ }
9493
+
9494
+ // packages/cli/client/localRuntimeTools.ts
9259
9495
  function buildOpenAiTools(args) {
9260
9496
  const toolset = buildLocalWorkspaceToolsetForEnv(args);
9261
9497
  const toolNameSet = new Set(args.toolNames ?? []);
@@ -9312,19 +9548,19 @@ function buildOpenAiTools(args) {
9312
9548
  }),
9313
9549
  ...buildServerPlatformOpenAiTools({ toolNames: args.toolNames }),
9314
9550
  ...buildNoloWorkspaceOpenAiTools({ toolNames: args.toolNames }),
9315
- // startAgentRun/controlAgentRun:CLI 本地 --bg 执行器已就绪(MED-1 修复,
9316
- // cliAgentRunToolExecutors),只要 agent 声明(agent-orchestration 包展开)
9317
- // 就注入 schema。
9318
9551
  ...prepareTools(
9319
9552
  ["startAgentRun", "controlAgentRun"].filter((name) => toolNameSet.has(name))
9320
9553
  )
9321
9554
  ];
9322
9555
  }
9323
9556
  var CLI_DEFAULT_TOOLS = ["exa_search", "fetchWebpage"];
9324
- function addDefaultCliCoreTools(toolNames, env) {
9557
+ function addDefaultCliCoreTools(toolNames, env, options) {
9325
9558
  const declaredOnly = env && shouldUseDeclaredOnlyLocalWorkspaceTools(env);
9326
- const injected = declaredOnly ? [...FORCED_TOOLS] : [...FORCED_TOOLS, ...CLI_DEFAULT_TOOLS];
9327
- return [.../* @__PURE__ */ new Set([...toolNames, ...injected])];
9559
+ const forcedTools = options?.hasUserChoice === true ? FORCED_TOOLS : FORCED_TOOLS.filter((name) => name !== "ui_ask_choice");
9560
+ const injected = declaredOnly ? [...forcedTools] : [...forcedTools, ...CLI_DEFAULT_TOOLS];
9561
+ const combined = [...toolNames, ...injected];
9562
+ const filtered = options?.hasUserChoice === true ? combined : combined.filter((name) => name !== "ui_ask_choice");
9563
+ return [...new Set(filtered)];
9328
9564
  }
9329
9565
  function resolveCliEffectiveEnabledPacks(args) {
9330
9566
  return resolveEffectiveEnabledPacks({
@@ -9349,16 +9585,12 @@ function withRuntimeEnabledPacksAndPrompt(config) {
9349
9585
  ...prompt ? { prompt } : {}
9350
9586
  };
9351
9587
  }
9352
- function resolveCliRequestedToolNames(agentConfig, env, systemBuiltinSkills) {
9588
+ function resolveCliRequestedToolNames(agentConfig, env, systemBuiltinSkills, options) {
9353
9589
  const declaredOnly = shouldUseDeclaredOnlyLocalWorkspaceTools(env);
9354
9590
  const expanded = addDefaultLightWebToolsForConfiguredAgents(
9355
9591
  addDefaultCliCoreTools(
9356
9592
  canonicalizeToolNames(
9357
9593
  expandEnabledPacks(
9358
- // CLI 端默认开 code 能力包:enabledPacks 为空时补 ["code"],保持
9359
- // 「CLI agent 默认能改代码」的体感,但走显式能力包而非隐式兜底
9360
- // (DEFAULT_LOCAL_CODING_TOOL_NAMES 已删除)。
9361
- // declared-only 模式下不补——用户显式要 ablation。
9362
9594
  resolveCliEffectiveEnabledPacks({
9363
9595
  enabledPacks: agentConfig?.enabledPacks,
9364
9596
  declaredOnly
@@ -9366,20 +9598,28 @@ function resolveCliRequestedToolNames(agentConfig, env, systemBuiltinSkills) {
9366
9598
  resolveRequestedRuntimeToolNames({ agentConfig })
9367
9599
  )
9368
9600
  ),
9369
- env
9601
+ env,
9602
+ options
9370
9603
  ),
9371
9604
  agentConfig
9372
9605
  );
9373
- const filtered = applySystemBuiltinSkillFilter(expanded, systemBuiltinSkills);
9606
+ const filtered = applySystemBuiltinSkillFilter(
9607
+ // Default-on system capabilities (agent-orchestration) are mounted for
9608
+ // every non-declared-only agent before the global filter runs, so the
9609
+ // user's global "off" still wins. declared-only (ablation) runs keep
9610
+ // their strict surface.
9611
+ declaredOnly ? expanded : addDefaultSystemCapabilityTools(expanded),
9612
+ systemBuiltinSkills
9613
+ );
9374
9614
  return applyDisabledTools(
9375
9615
  filtered,
9376
9616
  agentConfig?.disabledTools
9377
9617
  );
9378
9618
  }
9379
- function resolveProviderOpenAiToolBundle(agentConfig, env, buildTools = buildOpenAiTools, additionalToolNames = []) {
9619
+ function resolveProviderOpenAiToolBundle(agentConfig, env, buildTools = buildOpenAiTools, additionalToolNames = [], options) {
9380
9620
  const requestedToolNames = [
9381
9621
  .../* @__PURE__ */ new Set([
9382
- ...resolveCliRequestedToolNames(agentConfig, env),
9622
+ ...resolveCliRequestedToolNames(agentConfig, env, null, options),
9383
9623
  ...additionalToolNames
9384
9624
  ])
9385
9625
  ];
@@ -9401,18 +9641,16 @@ function buildLocalWorkspaceToolsetForEnv(args) {
9401
9641
  return toolset;
9402
9642
  }
9403
9643
  function buildLocalPolicyToolNames(args) {
9404
- const buildTools = args.buildTools ?? buildOpenAiTools;
9405
- return [
9406
- ...new Set(
9407
- summarizeOpenAiToolNames(
9408
- buildTools({
9409
- agentKey: args.agentKey,
9410
- toolNames: args.toolNames,
9411
- env: args.env
9412
- })
9413
- )
9414
- )
9415
- ];
9644
+ const schemaBuilder = args.buildProviderOpenAiTools ?? buildOpenAiTools;
9645
+ const tools = schemaBuilder({
9646
+ agentKey: args.agentKey,
9647
+ toolNames: args.toolNames,
9648
+ env: args.env
9649
+ });
9650
+ const policyNames = summarizeOpenAiToolNames(
9651
+ tools
9652
+ );
9653
+ return [...new Set(policyNames)];
9416
9654
  }
9417
9655
  function buildServerPlatformOpenAiTools(args) {
9418
9656
  const toolNameSet = new Set(args.toolNames ?? []);
@@ -9610,208 +9848,13 @@ function createCliCallAgentToolExecutor(deps, ctx) {
9610
9848
  }
9611
9849
  };
9612
9850
  }
9613
- async function resolveStore(deps) {
9614
- if (deps.store) return deps.store;
9615
- return createCliHybridRecordStore({
9616
- db: deps.db ?? await defaultLocalRuntimeDb(),
9617
- env: deps.env,
9618
- fetchImpl: deps.fetchImpl
9619
- });
9620
- }
9621
- async function getOrCreateSharedStore(deps) {
9622
- if (deps.store) return deps.store;
9623
- const cacheKey = normalizeRuntimeCacheCwd(deps.cwd);
9624
- let storePromise = hybridStoreCache.get(cacheKey);
9625
- if (!storePromise) {
9626
- storePromise = resolveStore(deps);
9627
- hybridStoreCache.set(cacheKey, storePromise);
9628
- }
9629
- return storePromise;
9630
- }
9631
- function createLocalDialogTitleGenerator(deps, ctx) {
9632
- return async (input) => {
9633
- if (!canUsePlatformChatProvider(deps.env)) {
9634
- return null;
9635
- }
9636
- const result = await generateLocalDialogTitle({
9637
- messages: input.messages,
9638
- env: deps.env,
9639
- fetchImpl: async (url, init) => fetchWithTransientRetry(
9640
- deps.fetchImpl ?? fetch,
9641
- url,
9642
- init,
9643
- {
9644
- sleep: deps.sleep,
9645
- loopbackRequest: ctx.loopbackRequest
9646
- }
9647
- ),
9648
- resolveProviderConfig: async (args) => resolvePlatformChatProviderConfig({
9649
- agentConfig: args.agentConfig,
9650
- env: args.env,
9651
- apiKeyRefResolver: ctx.apiKeyRefResolver,
9652
- credentialBroker: ctx.credentialBroker
9653
- }),
9654
- buildRequest: (args) => buildPlatformChatCompletionRequest({
9655
- providerConfig: args.providerConfig,
9656
- messages: args.messages,
9657
- stream: false
9658
- }),
9659
- parseResponse: (args) => parsePlatformChatCompletionResponse({
9660
- providerConfig: args.providerConfig,
9661
- data: args.data,
9662
- trace: []
9663
- }),
9664
- fallbackTitle: input.fallbackTitle,
9665
- timeoutMs: 15e3
9666
- });
9667
- return result.source === "llm" ? result.title : null;
9668
- };
9669
- }
9670
- async function writeLocalTokenRecord(args) {
9671
- const rawUsage = args.input.result.usage;
9672
- if (!rawUsage || typeof rawUsage !== "object" || Object.keys(rawUsage).length === 0) {
9673
- return;
9674
- }
9675
- const timestamp = args.now();
9676
- const prepared = prepareTokenUsageData({
9677
- rawUsage,
9678
- agentConfig: {
9679
- model: args.input.result.model || "unknown",
9680
- provider: args.input.result.provider,
9681
- apiSource: "cli"
9682
- },
9683
- userId: args.userId,
9684
- agentId: args.input.agentKey,
9685
- dialogId: args.dialogId,
9686
- timestamp,
9687
- entry_path: "cli-local"
9688
- });
9689
- const recordKey = createTokenKey.record(args.userId, timestamp);
9690
- const tokenRecord = {
9691
- id: args.createId(),
9692
- type: "token",
9693
- ...prepared.tokenData
9694
- };
9695
- await args.store.write(recordKey, tokenRecord);
9696
- }
9697
- async function writeDialog(args) {
9698
- let existingDialog = null;
9699
- if (args.input.continueDialogId) {
9700
- const dialogKey = `dialog-${args.userId}-${args.input.continueDialogId}`;
9701
- existingDialog = await args.store.read(dialogKey);
9702
- }
9703
- const authToken = resolveRuntimeAuthToken2(args.env);
9704
- const isLoggedIn = Boolean(authToken && parseUserIdFromAuthToken(authToken));
9705
- const hasExistingTitle = typeof existingDialog?.title === "string" && existingDialog.title.trim();
9706
- let titleOverride;
9707
- if (isLoggedIn && !hasExistingTitle && args.titleGenerator) {
9708
- const fallbackTitle = extractLastUserText(args.input.messages).trim().slice(0, 80) || "Local agent run";
9709
- try {
9710
- const generated = await args.titleGenerator({
9711
- messages: args.input.messages,
9712
- fallbackTitle
9713
- });
9714
- if (generated) {
9715
- titleOverride = generated;
9716
- }
9717
- } catch {
9718
- }
9719
- }
9720
- const plan = buildLocalDialogWritePlan({
9721
- input: args.input,
9722
- userId: args.userId,
9723
- now: args.now(),
9724
- createId: args.createId,
9725
- existingDialog,
9726
- cwd: args.cwd,
9727
- ...titleOverride ? { titleOverride } : {}
9728
- });
9729
- await args.store.batch(plan.ops);
9730
- try {
9731
- await writeLocalTokenRecord({
9732
- store: args.store,
9733
- input: args.input,
9734
- userId: args.userId,
9735
- dialogId: plan.dialogId,
9736
- now: args.now,
9737
- createId: args.createId,
9738
- output: args.output
9739
- });
9740
- } catch (error) {
9741
- args.output?.write(
9742
- `[nolo] Token usage record write failed (non-fatal): ${toErrorMessage(error)}
9743
- `
9744
- );
9745
- }
9746
- const hasSubjectRefs = localTurnHasSubjectRefs(args.input);
9747
- const isLocalUser = args.userId === "local";
9748
- if (!isLocalUser) {
9749
- try {
9750
- const syncResult = await syncLocalDialogEvidenceToRemote({
9751
- env: args.env,
9752
- fetchImpl: args.fetchImpl,
9753
- input: args.input,
9754
- ops: plan.ops,
9755
- output: args.output,
9756
- userId: args.userId
9757
- });
9758
- if (!syncResult.attempted) {
9759
- if (hasSubjectRefs) {
9760
- args.output?.write(
9761
- "[nolo] Local dialog evidence is local-only; set NOLO_SERVER and AUTH_TOKEN to make subjectRefs remotely queryable.\n"
9762
- );
9763
- }
9764
- }
9765
- } catch (error) {
9766
- if (hasSubjectRefs) {
9767
- throw error;
9768
- }
9769
- args.output?.write(
9770
- `[nolo] Remote dialog evidence sync failed; local dialog only: ${toErrorMessage(
9771
- error
9772
- )}
9773
- `
9774
- );
9775
- }
9776
- }
9777
- return { dialogId: plan.dialogId };
9778
- }
9779
- function resolveCliDialogRecordKey(userId, dialogId) {
9780
- if (dialogId.startsWith("dialog-") && !dialogId.includes("-msg-")) {
9781
- return dialogId;
9782
- }
9783
- return `dialog-${userId}-${dialogId}`;
9784
- }
9785
- async function loadCliDialogSummary(args) {
9786
- const dialogKey = resolveCliDialogRecordKey(args.userId, args.dialogId);
9787
- const record = await args.store.read(dialogKey);
9788
- if (!record || typeof record !== "object") return null;
9789
- const summary = typeof record.summary === "string" ? record.summary.trim() : "";
9790
- if (!summary) return null;
9791
- const summarizedBeforeId = record.summarizedBeforeId;
9792
- return {
9793
- summary,
9794
- ...typeof summarizedBeforeId === "string" && summarizedBeforeId ? { summarizedBeforeId } : {}
9795
- };
9796
- }
9797
- async function saveCliDialogSummary(args) {
9798
- const dialogKey = resolveCliDialogRecordKey(args.userId, args.dialogId);
9799
- const existing = await args.store.read(dialogKey) ?? {};
9800
- const bareId = typeof existing.id === "string" && existing.id ? existing.id : args.dialogId.startsWith("dialog-") ? args.dialogId.slice(args.dialogId.lastIndexOf("-") + 1) : args.dialogId;
9801
- const compressionCount = typeof existing.compressionCount === "number" ? existing.compressionCount + 1 : 1;
9802
- await args.store.write(dialogKey, {
9803
- ...existing,
9804
- id: bareId,
9805
- dbKey: dialogKey,
9806
- type: "dialog",
9807
- userId: args.userId,
9808
- summary: args.summary,
9809
- ...args.summarizedBeforeId !== void 0 ? { summarizedBeforeId: args.summarizedBeforeId } : {},
9810
- compressionCount,
9811
- summaryPending: false,
9812
- updatedAt: (/* @__PURE__ */ new Date()).toISOString()
9813
- });
9814
- }
9851
+
9852
+ // packages/cli/client/localRuntimeAdapter.ts
9853
+ var currentMetaFile = fileURLToPath(import.meta.url);
9854
+ var isJsBundle = extname(currentMetaFile) === ".js";
9855
+ var SOURCE_CLI_DIR = isJsBundle ? dirname(currentMetaFile) : dirname(dirname(currentMetaFile));
9856
+ var CLI_DIR = isCompiledBinary() ? dirname(process.execPath) : SOURCE_CLI_DIR;
9857
+ var CLI_ENTRYPOINT = isCompiledBinary() ? process.execPath : isJsBundle ? currentMetaFile : join(SOURCE_CLI_DIR, "index.ts");
9815
9858
  function createCliLocalRuntimeAdapter(deps) {
9816
9859
  const now = deps.now ?? Date.now;
9817
9860
  const createId = deps.createId ?? createFallbackId;
@@ -9883,7 +9926,13 @@ function createCliLocalRuntimeAdapter(deps) {
9883
9926
  deps.env
9884
9927
  );
9885
9928
  const agentConfig = baseAgentConfig ? withRuntimeEnabledPacksAndPrompt(baseAgentConfig) : baseAgentConfig;
9886
- const requestedToolNames = agentConfig ? resolveCliRequestedToolNames(agentConfig, deps.env, systemBuiltinSkills) : [];
9929
+ const hasUserChoice = Boolean(deps.requestUserChoice);
9930
+ const requestedToolNames = agentConfig ? resolveCliRequestedToolNames(
9931
+ agentConfig,
9932
+ deps.env,
9933
+ systemBuiltinSkills,
9934
+ { hasUserChoice }
9935
+ ) : [];
9887
9936
  activeAgentToolNames = buildLocalPolicyToolNames({
9888
9937
  agentKey: agentConfig?.key,
9889
9938
  toolNames: [...requestedToolNames, ...additionalToolNames],
@@ -10013,7 +10062,8 @@ function createCliLocalRuntimeAdapter(deps) {
10013
10062
  agentConfig,
10014
10063
  deps.env,
10015
10064
  buildProviderOpenAiTools,
10016
- additionalToolNames
10065
+ additionalToolNames,
10066
+ { hasUserChoice: Boolean(deps.requestUserChoice) }
10017
10067
  );
10018
10068
  logLocalRuntimeDiagnostic("provider.selected", {
10019
10069
  agentKey: agentConfig.key,
@@ -10094,7 +10144,8 @@ function createCliLocalRuntimeAdapter(deps) {
10094
10144
  agentConfig,
10095
10145
  deps.env,
10096
10146
  buildProviderOpenAiTools,
10097
- additionalToolNames
10147
+ additionalToolNames,
10148
+ { hasUserChoice: Boolean(deps.requestUserChoice) }
10098
10149
  );
10099
10150
  logLocalRuntimeDiagnostic("provider.selected", {
10100
10151
  agentKey: agentConfig.key,
@@ -10160,7 +10211,8 @@ function createCliLocalRuntimeAdapter(deps) {
10160
10211
  agentConfig,
10161
10212
  deps.env,
10162
10213
  buildProviderOpenAiTools,
10163
- additionalToolNames
10214
+ additionalToolNames,
10215
+ { hasUserChoice: Boolean(deps.requestUserChoice) }
10164
10216
  );
10165
10217
  logLocalRuntimeDiagnostic("provider.selected", {
10166
10218
  agentKey: agentConfig.key,
@@ -10243,7 +10295,8 @@ function createCliLocalRuntimeAdapter(deps) {
10243
10295
  agentConfig,
10244
10296
  deps.env,
10245
10297
  buildProviderOpenAiTools,
10246
- additionalToolNames
10298
+ additionalToolNames,
10299
+ { hasUserChoice: Boolean(deps.requestUserChoice) }
10247
10300
  );
10248
10301
  return {
10249
10302
  model: providerConfig2.model,
@@ -10399,7 +10452,8 @@ function createCliLocalRuntimeAdapter(deps) {
10399
10452
  agentConfig,
10400
10453
  deps.env,
10401
10454
  buildProviderOpenAiTools,
10402
- additionalToolNames
10455
+ additionalToolNames,
10456
+ { hasUserChoice: Boolean(deps.requestUserChoice) }
10403
10457
  );
10404
10458
  return {
10405
10459
  model: providerConfig.model,