nolo-cli 0.73.0-alpha.1 → 0.73.0

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 (72) hide show
  1. package/{_executeModel-YCKNRHGK.js → _executeModel-L4LCNFID.js} +15 -15
  2. package/{agentDeleteCommand-FSIMTL4K.js → agentDeleteCommand-COEAQ4NI.js} +10 -10
  3. package/{agentEmailCommands-NB4LKSYO.js → agentEmailCommands-JGAV4CY4.js} +20 -19
  4. package/{agentListCommands-2YWZYH52.js → agentListCommands-LKSEO2CX.js} +13 -13
  5. package/{agentMachineCommands-KY64CTJQ.js → agentMachineCommands-CJTIHC4J.js} +10 -10
  6. package/{agentRecordCommands-QSMNZZJG.js → agentRecordCommands-AJU74C7D.js} +20 -19
  7. package/{agentRunCommand-J46VK6FV.js → agentRunCommand-UHKKYRTL.js} +21 -20
  8. package/{agentRuntimeLocal-O6DZDTK4.js → agentRuntimeLocal-FOR7RUGO.js} +10 -10
  9. package/{agentSlice-SLXBJ4NO.js → agentSlice-43ORUHTC.js} +1 -1
  10. package/{appDeleteCommands-HIJNWSK7.js → appDeleteCommands-FFS2TFI6.js} +11 -11
  11. package/{appDeployCommands-XULV2ZN6.js → appDeployCommands-OEDNTUTL.js} +11 -11
  12. package/{appDeployStatusCommands-ETY4Z7K6.js → appDeployStatusCommands-6GMLQMNZ.js} +11 -11
  13. package/{appGetCommands-M253LKDA.js → appGetCommands-KENXRWWU.js} +11 -11
  14. package/{appListCommands-XYFXJMNP.js → appListCommands-RH3LPDOI.js} +11 -11
  15. package/{chatQueueReduxAdapter-QM2VAX2O.js → chatQueueReduxAdapter-F3IRDXDQ.js} +2 -2
  16. package/chromeCommands-VOIRNJBL.js +499 -0
  17. package/chromeOpsCommands-M7DPCX2T.js +258 -0
  18. package/{chunk-RZXW3OQR.js → chunk-3AYN7JOX.js} +99 -14
  19. package/{chunk-RFUMIH4D.js → chunk-6S3P22RD.js} +23 -7
  20. package/{chunk-ZFCKTVS5.js → chunk-7QHSEMMD.js} +2 -2
  21. package/{chunk-CJ23A7U4.js → chunk-AFG4XK2P.js} +25 -16
  22. package/{chunk-Q6FF2MCK.js → chunk-BOYUESO7.js} +1 -1
  23. package/{chunk-3Q6IRFKW.js → chunk-BWVFOBTO.js} +5586 -355
  24. package/{chunk-ZLPA7K55.js → chunk-CPSZJBLK.js} +1 -1
  25. package/{chunk-2QDDKFG5.js → chunk-CQ3WA2NE.js} +77 -0
  26. package/{chunk-B62OSA77.js → chunk-D6XYLSOS.js} +1 -1
  27. package/{chunk-O5BQBXPT.js → chunk-DAIOZ3ZO.js} +66 -120
  28. package/{chunk-JWO3RQSH.js → chunk-DUJWWUGV.js} +1 -1
  29. package/{chunk-EDKF7RX4.js → chunk-EOARMOVD.js} +2 -0
  30. package/{chunk-T7PQFKJU.js → chunk-FNGAF7C4.js} +2 -2
  31. package/{chunk-OVIWUKZU.js → chunk-GEH7MMBB.js} +1 -1
  32. package/{chunk-IZVGS7I4.js → chunk-IHTVDCWH.js} +2 -2
  33. package/{chunk-KZNSQBYS.js → chunk-J4R5XRX5.js} +43 -39
  34. package/{chunk-72I27DY3.js → chunk-JQBONKAV.js} +2 -2
  35. package/{chunk-YCDWJX45.js → chunk-KC5FAHVS.js} +1 -1
  36. package/{chunk-3U3EA3BO.js → chunk-KVDUCO4Q.js} +3 -3
  37. package/{chunk-AUKZOZFG.js → chunk-NRALD3CC.js} +2 -2
  38. package/{chunk-TVCEQO7Z.js → chunk-PEIXE6MU.js} +2 -2
  39. package/{chunk-HXAINXPQ.js → chunk-QC5LGHYP.js} +1 -1
  40. package/chunk-QCZX4FTW.js +242 -0
  41. package/{chunk-26Q7BEUX.js → chunk-QNWHWBB7.js} +5 -5
  42. package/{chunk-CHF7R74H.js → chunk-QQ7SX52C.js} +5 -5
  43. package/{chunk-BUWJ35JI.js → chunk-QQBO3LQW.js} +25 -11
  44. package/{chunk-Q4OT2DC7.js → chunk-WL2RKIBF.js} +1 -1
  45. package/{chunk-IDZTNRP2.js → chunk-X7HHHIOZ.js} +10 -2
  46. package/{chunk-NO5V2FJH.js → chunk-XKNBWXDH.js} +3 -3
  47. package/{chunk-FPTQQSS6.js → chunk-YWG6EMH3.js} +23 -2
  48. package/{chunk-V3ZKNK5D.js → chunk-ZVN6I33J.js} +5 -5
  49. package/{contentThunks-L25U6PGY.js → contentThunks-FSQPOFYG.js} +3 -3
  50. package/{createAgentAutomationAction-AVO4SGAB.js → createAgentAutomationAction-VCHDRJ6X.js} +3 -3
  51. package/{createDialogAction-CRM7655J.js → createDialogAction-KZM5IE4P.js} +4 -4
  52. package/{createPageAction-MZBXQPMN.js → createPageAction-IGMXJOY3.js} +3 -3
  53. package/{dialogCommands-PE5FEFJ5.js → dialogCommands-WLE4ZHK3.js} +11 -11
  54. package/{dialogSlice-DVUADIHJ.js → dialogSlice-YBTC3GAW.js} +2 -2
  55. package/{docCreateCommands-IPDFZVPG.js → docCreateCommands-LIZEUYKH.js} +10 -10
  56. package/{docDeleteCommands-VQ4Y66CM.js → docDeleteCommands-SSZWXPT6.js} +11 -11
  57. package/{docReadCommands-PD33VV27.js → docReadCommands-IUEKS6JR.js} +10 -10
  58. package/{docStore-OREDKMJV.js → docStore-SDPT23I6.js} +1 -1
  59. package/{docUpdateCommands-CGUQ2JY3.js → docUpdateCommands-R4CGESVN.js} +10 -10
  60. package/{handleSendMessageAction-4EZCK5L4.js → handleSendMessageAction-356IDG72.js} +2 -2
  61. package/index.js +108 -48
  62. package/{machineCommands-LILMX4Q6.js → machineCommands-H6F3GXOE.js} +19 -18
  63. package/{machineWsRunDispatch-CS5WKOMR.js → machineWsRunDispatch-MB55UMT5.js} +19 -18
  64. package/package.json +1 -1
  65. package/{readlineWorkspace-TNCGQG3G.js → readlineWorkspace-WOZVBRMC.js} +52 -33
  66. package/{runAgentClientLoop-DLBWIW7B.js → runAgentClientLoop-DKUUFUKT.js} +13 -13
  67. package/{spaceCommands-Y47DDAQD.js → spaceCommands-3XCQ2RRJ.js} +10 -10
  68. package/{streamAgentChatTurn-PC75F4UN.js → streamAgentChatTurn-FHZZCANP.js} +16 -16
  69. package/{tools-F5DJNXLT.js → tools-QZJX3BIC.js} +10 -8
  70. package/{tuiSummaryLlmCaller-J5BEPLW5.js → tuiSummaryLlmCaller-3Z24VUWM.js} +2 -2
  71. package/{updateCommands-AJYSD73Y.js → updateCommands-Y363MC3L.js} +2 -2
  72. package/{updateDialogTitleAction-IHI6S2PU.js → updateDialogTitleAction-JJPNGTAP.js} +3 -3
@@ -0,0 +1,258 @@
1
+ import {
2
+ createChromeConnectorClient
3
+ } from "./chunk-QCZX4FTW.js";
4
+ import {
5
+ toErrorMessage
6
+ } from "./chunk-HNMXYYJR.js";
7
+ import {
8
+ readOption
9
+ } from "./chunk-A7GB5UGH.js";
10
+ import "./chunk-OLZBQWZU.js";
11
+ import "./chunk-KUG52IAP.js";
12
+ import "./chunk-LCBAMY2M.js";
13
+ import "./chunk-4SN6J65J.js";
14
+ import "./chunk-CF7PE763.js";
15
+ import "./chunk-G3SUCT4W.js";
16
+ import "./chunk-4VNS5WPM.js";
17
+
18
+ // packages/cli/chromeOpsCommands.ts
19
+ import { writeFile } from "node:fs/promises";
20
+ function wantsHelp(args) {
21
+ return args.includes("--help") || args.includes("-h");
22
+ }
23
+ function readTrimmedOption(args, flag) {
24
+ return (readOption(args, flag) ?? "").trim();
25
+ }
26
+ function readIntOption(args, flag, usage) {
27
+ const raw = readOption(args, flag);
28
+ if (raw === void 0) return void 0;
29
+ const value = Number.parseInt(raw, 10);
30
+ if (!Number.isFinite(value)) {
31
+ throw new Error(`Invalid ${flag} <N>. Usage: ${usage}`);
32
+ }
33
+ return value;
34
+ }
35
+ function requireTabId(args, usage) {
36
+ const tabId = readTrimmedOption(args, "--tab");
37
+ if (!tabId) {
38
+ throw new Error(`Missing required --tab <id>. Usage: ${usage}`);
39
+ }
40
+ return tabId;
41
+ }
42
+ function requireTarget(args, usage) {
43
+ const elementRef = readTrimmedOption(args, "--ref");
44
+ const selector = readTrimmedOption(args, "--selector");
45
+ if (!elementRef && !selector) {
46
+ throw new Error(
47
+ `Provide --ref <elementRef> (from read-page) or --selector <css>. Usage: ${usage}`
48
+ );
49
+ }
50
+ return {
51
+ ...elementRef ? { elementRef } : {},
52
+ ...selector ? { selector } : {}
53
+ };
54
+ }
55
+ var CHROME_OPS_SUBCOMMANDS = {
56
+ "list-tabs": {
57
+ action: "list_tabs",
58
+ usage: "nolo chrome list-tabs",
59
+ payload: () => ({})
60
+ },
61
+ "open-tab": {
62
+ action: "open_tab",
63
+ usage: "nolo chrome open-tab --url <url> [--active]",
64
+ payload: (args, usage) => {
65
+ const url = readTrimmedOption(args, "--url");
66
+ if (!url) {
67
+ throw new Error(`Missing required --url <url>. Usage: ${usage}`);
68
+ }
69
+ return { url, active: args.includes("--active") };
70
+ }
71
+ },
72
+ "close-tab": {
73
+ action: "close_tab",
74
+ usage: "nolo chrome close-tab --tab <id>",
75
+ payload: (args, usage) => ({ tabId: requireTabId(args, usage) })
76
+ },
77
+ "read-page": {
78
+ action: "read_page",
79
+ usage: "nolo chrome read-page --tab <id> [--selector <css>] [--detail compact|full] [--max-elements N]",
80
+ payload: (args, usage) => {
81
+ const payload = { tabId: requireTabId(args, usage) };
82
+ const selector = readTrimmedOption(args, "--selector");
83
+ if (selector) payload.selector = selector;
84
+ const detail = readTrimmedOption(args, "--detail");
85
+ if (detail) payload.detail = detail;
86
+ const maxElements = readIntOption(args, "--max-elements", usage);
87
+ if (maxElements !== void 0) payload.maxElements = maxElements;
88
+ return payload;
89
+ }
90
+ },
91
+ click: {
92
+ action: "click",
93
+ usage: "nolo chrome click --tab <id> (--ref <elementRef> | --selector <css>)",
94
+ payload: (args, usage) => ({
95
+ tabId: requireTabId(args, usage),
96
+ ...requireTarget(args, usage)
97
+ })
98
+ },
99
+ type: {
100
+ action: "type",
101
+ usage: "nolo chrome type --tab <id> (--ref <elementRef> | --selector <css>) --text <text> [--append]",
102
+ payload: (args, usage) => {
103
+ const text = readOption(args, "--text");
104
+ if (text === void 0 || text.startsWith("--")) {
105
+ throw new Error(`Missing required --text <text>. Usage: ${usage}`);
106
+ }
107
+ return {
108
+ tabId: requireTabId(args, usage),
109
+ ...requireTarget(args, usage),
110
+ text,
111
+ ...args.includes("--append") ? { clearFirst: false } : {}
112
+ };
113
+ }
114
+ },
115
+ press: {
116
+ action: "press",
117
+ usage: "nolo chrome press --tab <id> --key <key>",
118
+ payload: (args, usage) => {
119
+ const key = readTrimmedOption(args, "--key");
120
+ if (!key) {
121
+ throw new Error(`Missing required --key <key>. Usage: ${usage}`);
122
+ }
123
+ return { tabId: requireTabId(args, usage), key };
124
+ }
125
+ },
126
+ scroll: {
127
+ action: "scroll",
128
+ usage: "nolo chrome scroll --tab <id> [--delta-x N] [--delta-y N]",
129
+ payload: (args, usage) => {
130
+ const payload = { tabId: requireTabId(args, usage) };
131
+ const deltaX = readIntOption(args, "--delta-x", usage);
132
+ const deltaY = readIntOption(args, "--delta-y", usage);
133
+ if (deltaX !== void 0) payload.deltaX = deltaX;
134
+ if (deltaY !== void 0) payload.deltaY = deltaY;
135
+ return payload;
136
+ }
137
+ },
138
+ screenshot: {
139
+ action: "screenshot",
140
+ usage: "nolo chrome screenshot --tab <id> [--out <path>] [--full-page]",
141
+ payload: (args, usage) => ({
142
+ tabId: requireTabId(args, usage),
143
+ ...args.includes("--full-page") ? { fullPage: true } : {}
144
+ })
145
+ },
146
+ "read-console": {
147
+ action: "read_console",
148
+ usage: "nolo chrome read-console --tab <id> [--limit N]",
149
+ payload: (args, usage) => {
150
+ const payload = { tabId: requireTabId(args, usage) };
151
+ const limit = readIntOption(args, "--limit", usage);
152
+ if (limit !== void 0) payload.limit = limit;
153
+ return payload;
154
+ }
155
+ },
156
+ "read-network": {
157
+ action: "read_network",
158
+ usage: "nolo chrome read-network --tab <id> [--limit N] [--include-assets]",
159
+ payload: (args, usage) => {
160
+ const payload = { tabId: requireTabId(args, usage) };
161
+ const limit = readIntOption(args, "--limit", usage);
162
+ if (limit !== void 0) payload.limit = limit;
163
+ if (args.includes("--include-assets")) payload.includeAssets = true;
164
+ return payload;
165
+ }
166
+ }
167
+ };
168
+ function renderChromeOpsHelp() {
169
+ const lines = [
170
+ "Operate the user's Chrome through the Nolo Chrome connector (the desktop bridge;",
171
+ "the same RPC the chrome_* agent tools use).",
172
+ "",
173
+ "Usage:",
174
+ " nolo chrome <subcommand> [flags]",
175
+ "",
176
+ "Subcommands:",
177
+ ...Object.values(CHROME_OPS_SUBCOMMANDS).map(
178
+ (spec) => ` ${spec.usage.replace(/^nolo chrome /, "")}`
179
+ ),
180
+ "",
181
+ "Notes:",
182
+ " --ref takes an elementRef copied from `nolo chrome read-page` (revision-scoped,",
183
+ " preferred over --selector); --selector takes a CSS selector.",
184
+ " Actions the connector classifies as irreversible (Submit / Delete / Pay ...)",
185
+ " are refused with CONFIRMATION_REQUIRED \u2014 ask the user to perform them.",
186
+ " Every subcommand prints the connector's raw JSON result; failures exit 1.",
187
+ " Endpoint: NOLO_CHROME_CONNECTOR_RPC_URL or http://127.0.0.1:38947/rpc."
188
+ ];
189
+ return lines.join("\n");
190
+ }
191
+ var CHROME_OPS_HELP_TEXT = renderChromeOpsHelp();
192
+ async function runChromeOpsCommand(subcommand, args, deps = {}) {
193
+ const io = {
194
+ stdout: (text) => console.log(text),
195
+ stderr: (text) => console.error(text),
196
+ ...deps.io
197
+ };
198
+ const spec = CHROME_OPS_SUBCOMMANDS[subcommand];
199
+ if (!spec) {
200
+ io.stderr(`Unknown chrome subcommand: ${subcommand}
201
+
202
+ ${CHROME_OPS_HELP_TEXT}`);
203
+ return 1;
204
+ }
205
+ if (wantsHelp(args)) {
206
+ io.stdout(CHROME_OPS_HELP_TEXT);
207
+ return 0;
208
+ }
209
+ let payload;
210
+ try {
211
+ payload = spec.payload(args, spec.usage);
212
+ } catch (error) {
213
+ io.stderr(toErrorMessage(error));
214
+ return 1;
215
+ }
216
+ let result;
217
+ try {
218
+ const client = deps.client ?? createChromeConnectorClient();
219
+ result = await client.request(spec.action, payload);
220
+ } catch (error) {
221
+ const code = typeof error?.code === "string" ? error.code : "CHROME_COMMAND_FAILED";
222
+ io.stderr(JSON.stringify({ ok: false, error: { code, message: toErrorMessage(error) } }, null, 2));
223
+ return 1;
224
+ }
225
+ if (subcommand === "screenshot") {
226
+ const out = readTrimmedOption(args, "--out");
227
+ const dataUrl = result?.dataUrl;
228
+ if (out && typeof dataUrl === "string") {
229
+ const base64 = dataUrl.includes(",") ? dataUrl.slice(dataUrl.indexOf(",") + 1) : dataUrl;
230
+ const bytes = Buffer.from(base64, "base64");
231
+ try {
232
+ await writeFile(out, bytes);
233
+ } catch (error) {
234
+ io.stderr(
235
+ JSON.stringify(
236
+ {
237
+ ok: false,
238
+ error: { code: "SCREENSHOT_WRITE_FAILED", message: toErrorMessage(error) }
239
+ },
240
+ null,
241
+ 2
242
+ )
243
+ );
244
+ return 1;
245
+ }
246
+ io.stdout(JSON.stringify({ ok: true, result: { savedTo: out, bytes: bytes.byteLength } }, null, 2));
247
+ return 0;
248
+ }
249
+ }
250
+ io.stdout(JSON.stringify({ ok: true, result }, null, 2));
251
+ return 0;
252
+ }
253
+ export {
254
+ CHROME_OPS_HELP_TEXT,
255
+ CHROME_OPS_SUBCOMMANDS,
256
+ renderChromeOpsHelp,
257
+ runChromeOpsCommand
258
+ };
@@ -5,6 +5,11 @@ import {
5
5
  refreshOpenAiCodexToken,
6
6
  xaiRefresh
7
7
  } from "./chunk-GBPZKFYK.js";
8
+ import {
9
+ createChromeConnectorClient,
10
+ createVerifiedChromeConnectorClient,
11
+ executeChromeConnectorTool
12
+ } from "./chunk-QCZX4FTW.js";
8
13
  import {
9
14
  defaultLoopbackRequest
10
15
  } from "./chunk-EADNWBAZ.js";
@@ -35,7 +40,7 @@ import {
35
40
  } from "./chunk-DWUCB2A3.js";
36
41
  import {
37
42
  buildLocalAgentLookupKeys
38
- } from "./chunk-Q6FF2MCK.js";
43
+ } from "./chunk-BOYUESO7.js";
39
44
  import {
40
45
  LOCAL_CODEX_AGENT_ID,
41
46
  LOCAL_CODEX_AGENT_KEY,
@@ -55,11 +60,12 @@ import {
55
60
  import {
56
61
  inlineImageUrlsForCustomProvider,
57
62
  prepareTools
58
- } from "./chunk-ZFCKTVS5.js";
63
+ } from "./chunk-7QHSEMMD.js";
59
64
  import {
60
65
  getServerProviderSecret
61
66
  } from "./chunk-HS7MLR74.js";
62
67
  import {
68
+ CHROME_CONNECTOR_TOOL_NAMES,
63
69
  CONTROL_AGENT_RUN_ACTIONS,
64
70
  buildControlAgentRunFunctionSchema,
65
71
  buildStartAgentRunFunctionSchema,
@@ -72,7 +78,7 @@ import {
72
78
  rememberMemoryFunctionSchema,
73
79
  resolveAgentRequiredPackIds,
74
80
  setTodoListFunc
75
- } from "./chunk-BUWJ35JI.js";
81
+ } from "./chunk-QQBO3LQW.js";
76
82
  import {
77
83
  fetchWithTransientRetry,
78
84
  isTransientFetchError
@@ -95,13 +101,13 @@ import {
95
101
  prepareTokenUsageData,
96
102
  resolveBuiltinPlatformAgentConfig,
97
103
  runKeyed
98
- } from "./chunk-KZNSQBYS.js";
104
+ } from "./chunk-J4R5XRX5.js";
99
105
  import {
100
106
  BUILTIN_TITLE_LLM_CONFIG
101
107
  } from "./chunk-EVBFYPDC.js";
102
108
  import {
103
109
  fetchServerSyncedCredential
104
- } from "./chunk-NO5V2FJH.js";
110
+ } from "./chunk-XKNBWXDH.js";
105
111
  import {
106
112
  require_date_fns
107
113
  } from "./chunk-M76ECQRD.js";
@@ -153,7 +159,7 @@ import {
153
159
  resolveOpenAiCompatibleProviderConfig,
154
160
  shouldUseGeminiNativeToolRoute,
155
161
  summarizeToolArguments
156
- } from "./chunk-CJ23A7U4.js";
162
+ } from "./chunk-AFG4XK2P.js";
157
163
  import {
158
164
  PlatformStreamInterruptedError,
159
165
  buildPlatformChatCompletionRequest,
@@ -165,7 +171,7 @@ import {
165
171
  readSseDataValues,
166
172
  resolvePlatformChatProviderConfig,
167
173
  shouldUsePlatformChatProvider
168
- } from "./chunk-HXAINXPQ.js";
174
+ } from "./chunk-QC5LGHYP.js";
169
175
  import {
170
176
  resolveAgentRuntimeConfigFromRecord,
171
177
  resolveHistoricalToolContentCap
@@ -176,22 +182,22 @@ import {
176
182
  stablePromptCacheKey,
177
183
  toResponsesTools
178
184
  } from "./chunk-PUOC4YRO.js";
179
- import {
180
- isAntigravityOAuthAgent
181
- } from "./chunk-PGSKWZCB.js";
182
- import {
183
- resolvePlatformAuthToken
184
- } from "./chunk-CMH2SYHX.js";
185
185
  import {
186
186
  buildNoloWorkspaceOpenAiTools,
187
187
  parseNoloWorkspaceToolArguments,
188
188
  resolveRuntimeToolSurfaceForAgent
189
- } from "./chunk-V3ZKNK5D.js";
189
+ } from "./chunk-ZVN6I33J.js";
190
190
  import {
191
191
  mergeAvailabilityDeadline,
192
192
  resolveAvailabilityAction,
193
193
  resolveCooldownGate
194
194
  } from "./chunk-CJCJF5XB.js";
195
+ import {
196
+ isAntigravityOAuthAgent
197
+ } from "./chunk-PGSKWZCB.js";
198
+ import {
199
+ resolvePlatformAuthToken
200
+ } from "./chunk-CMH2SYHX.js";
195
201
  import {
196
202
  buildDialogFallbackTitleFromUserInput,
197
203
  normalizeDialogTitle
@@ -1672,6 +1678,17 @@ var LOCAL_SERVER_MEMORY_TOOL_NAME_SET = new Set(
1672
1678
  );
1673
1679
 
1674
1680
  // packages/cli/client/localRuntimeTools.ts
1681
+ var CLI_CHROME_CONNECTOR_TOOL_NAME_SET = new Set(
1682
+ CHROME_CONNECTOR_TOOL_NAMES
1683
+ );
1684
+ function filterCliChromeConnectorToolNames(toolNames) {
1685
+ return (toolNames ?? []).filter(
1686
+ (name) => CLI_CHROME_CONNECTOR_TOOL_NAME_SET.has(name)
1687
+ );
1688
+ }
1689
+ function buildCliChromeConnectorOpenAiTools(args) {
1690
+ return prepareTools(filterCliChromeConnectorToolNames(args.toolNames));
1691
+ }
1675
1692
  function buildOpenAiTools(args) {
1676
1693
  const toolset = buildLocalWorkspaceToolsetForEnv(args);
1677
1694
  const workspaceToolNames = toolset.toolNames;
@@ -1719,6 +1736,7 @@ function buildOpenAiTools(args) {
1719
1736
  toolNames: args.effectiveToolNames ?? workspaceToolNames,
1720
1737
  exposeShellTools: toolset.exposeShellTools
1721
1738
  }),
1739
+ ...buildCliChromeConnectorOpenAiTools({ toolNames: args.toolNames }),
1722
1740
  ...buildServerPlatformOpenAiTools({ toolNames: args.toolNames }),
1723
1741
  ...buildNoloWorkspaceOpenAiTools({ toolNames: args.toolNames }),
1724
1742
  ...buildOrchestrationOpenAiTools({
@@ -2524,6 +2542,46 @@ async function detectCurrentMachineId(env) {
2524
2542
  }
2525
2543
 
2526
2544
  // packages/cli/client/cliProviderHelpers.ts
2545
+ var CYCLE_SCAN_NODE_BUDGET = 2e4;
2546
+ function keysForJson(value) {
2547
+ if (Array.isArray(value)) {
2548
+ const keys = [];
2549
+ for (let i = 0; i < value.length; i++) keys.push(String(i));
2550
+ return keys;
2551
+ }
2552
+ return Object.keys(value);
2553
+ }
2554
+ function hasJsonCycle(root) {
2555
+ if (typeof root !== "object" || root === null) return false;
2556
+ if (typeof root.toJSON === "function") return false;
2557
+ const onPath = /* @__PURE__ */ new Set([root]);
2558
+ const stack = [
2559
+ { holder: root, keys: keysForJson(root), index: 0 }
2560
+ ];
2561
+ let visited = 1;
2562
+ while (stack.length > 0) {
2563
+ const frame = stack[stack.length - 1];
2564
+ if (frame.index >= frame.keys.length) {
2565
+ onPath.delete(frame.holder);
2566
+ stack.pop();
2567
+ continue;
2568
+ }
2569
+ const key = frame.keys[frame.index++];
2570
+ let child;
2571
+ try {
2572
+ child = frame.holder[key];
2573
+ } catch {
2574
+ continue;
2575
+ }
2576
+ if (typeof child !== "object" || child === null) continue;
2577
+ if (typeof child.toJSON === "function") continue;
2578
+ if (onPath.has(child)) return true;
2579
+ if (++visited > CYCLE_SCAN_NODE_BUDGET) return false;
2580
+ onPath.add(child);
2581
+ stack.push({ holder: child, keys: keysForJson(child), index: 0 });
2582
+ }
2583
+ return false;
2584
+ }
2527
2585
  function buildDelegatedTaskContent(task, input) {
2528
2586
  if (input === void 0 || input === null) {
2529
2587
  return task;
@@ -2540,6 +2598,9 @@ ${input}`;
2540
2598
  }
2541
2599
  let jsonStr;
2542
2600
  try {
2601
+ if (hasJsonCycle(input)) {
2602
+ throw new TypeError("Converting circular structure to JSON");
2603
+ }
2543
2604
  const serialized = JSON.stringify(input, null, 2);
2544
2605
  if (serialized === void 0) {
2545
2606
  return task;
@@ -2564,6 +2625,9 @@ function calculateDelegatedPayloadMetrics(task, input, delegatedContent) {
2564
2625
  serializedInputForTokens = input;
2565
2626
  } else {
2566
2627
  try {
2628
+ if (hasJsonCycle(input)) {
2629
+ throw new TypeError("Converting circular structure to JSON");
2630
+ }
2567
2631
  const serialized = JSON.stringify(input, null, 2);
2568
2632
  if (serialized !== void 0) {
2569
2633
  inputChars = serialized.length;
@@ -11271,6 +11335,19 @@ function createCliControlAgentRunExecutor(deps = {}) {
11271
11335
  };
11272
11336
  }
11273
11337
 
11338
+ // packages/cli/client/cliChromeConnectorToolExecutors.ts
11339
+ function buildCliChromeConnectorToolExecutors(args) {
11340
+ const client = createVerifiedChromeConnectorClient({
11341
+ client: args?.client ?? createChromeConnectorClient()
11342
+ });
11343
+ return Object.fromEntries(
11344
+ CHROME_CONNECTOR_TOOL_NAMES.map((toolName) => [
11345
+ toolName,
11346
+ (call) => executeChromeConnectorTool({ client, call })
11347
+ ])
11348
+ );
11349
+ }
11350
+
11274
11351
  // packages/cli/client/cliLocalToolExecutors.ts
11275
11352
  var MAX_PASTED_TEXT_LINES_PER_READ = 200;
11276
11353
  var PASTED_TEXT_EXPLICIT_OVERSHOOT_LINES = 20;
@@ -11557,6 +11634,12 @@ function buildLocalToolExecutors(args) {
11557
11634
  };
11558
11635
  },
11559
11636
  ...args.pastedTextStore ? { readPastedText: createReadPastedTextExecutor(args.pastedTextStore) } : {},
11637
+ // Nolo Browser Connector: the CLI drives the user's real Chrome through the same verified
11638
+ // client + executor as the desktop runtime (before this, every chrome_* call answered
11639
+ // "only executable in the Nolo desktop local runtime").
11640
+ ...buildCliChromeConnectorToolExecutors(
11641
+ args.chromeConnectorClient ? { client: args.chromeConnectorClient } : {}
11642
+ ),
11560
11643
  ...args.localToolExecutors ?? {}
11561
11644
  };
11562
11645
  }
@@ -12389,6 +12472,7 @@ function createCliLocalRuntimeAdapter(deps) {
12389
12472
  workspaceRoot,
12390
12473
  env: deps.env,
12391
12474
  fetchImpl,
12475
+ ...deps.chromeConnectorClient ? { chromeConnectorClient: deps.chromeConnectorClient } : {},
12392
12476
  localToolExecutors: deps.localToolExecutors,
12393
12477
  readXPost: deps.readXPost,
12394
12478
  readXhsProfile: deps.readXhsProfile,
@@ -12465,6 +12549,7 @@ function createCliLocalRuntimeAdapter(deps) {
12465
12549
  workspaceRoot,
12466
12550
  env: deps.env,
12467
12551
  fetchImpl,
12552
+ ...deps.chromeConnectorClient ? { chromeConnectorClient: deps.chromeConnectorClient } : {},
12468
12553
  localToolExecutors: deps.localToolExecutors,
12469
12554
  readXPost: deps.readXPost,
12470
12555
  readXhsProfile: deps.readXhsProfile,
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  createCliLocalRuntimeAdapter,
3
3
  summarizeEndpoint
4
- } from "./chunk-RZXW3OQR.js";
4
+ } from "./chunk-3AYN7JOX.js";
5
5
  import {
6
6
  clipMultilineText
7
- } from "./chunk-BUWJ35JI.js";
7
+ } from "./chunk-QQBO3LQW.js";
8
8
  import {
9
9
  runLocalAgentTurn
10
- } from "./chunk-CJ23A7U4.js";
10
+ } from "./chunk-AFG4XK2P.js";
11
11
  import {
12
12
  applyToolSurfaceConstraints
13
- } from "./chunk-V3ZKNK5D.js";
13
+ } from "./chunk-ZVN6I33J.js";
14
14
  import {
15
15
  resolveLocalRuntimeEnvFromPolicy
16
16
  } from "./chunk-3JQ2NRYU.js";
@@ -20,7 +20,7 @@ import {
20
20
  import {
21
21
  readPipeText,
22
22
  spawnProcess
23
- } from "./chunk-IDZTNRP2.js";
23
+ } from "./chunk-X7HHHIOZ.js";
24
24
  import {
25
25
  parseUserIdFromAuthToken
26
26
  } from "./chunk-A7GB5UGH.js";
@@ -133,6 +133,7 @@ function resolveConnectorRunCwd(args) {
133
133
  }
134
134
  return cwd;
135
135
  }
136
+ var RUN_GIT_TIMEOUT_MS = 1e4;
136
137
  async function runGit(args, cwd, options = {}) {
137
138
  const proc = spawnProcess({
138
139
  cmd: ["git", ...args],
@@ -141,9 +142,24 @@ async function runGit(args, cwd, options = {}) {
141
142
  stderr: "pipe",
142
143
  stdin: "ignore"
143
144
  });
144
- const [stdout, exitCode] = await Promise.all([
145
+ const [stdout, , exitCode] = await Promise.all([
145
146
  readPipeText(proc.stdout),
146
- proc.exited
147
+ // git 在非仓库目录对 diff 系子命令会向 stderr 打印整段 usage(数十 KB):
148
+ // 不消费 stderr 会让 git 阻塞在写满的 stderr 管道上永不退出(bun:child_process),
149
+ // proc.exited 随之永不 resolve——connector 收尾整体挂死(2026-09-16 实测)。
150
+ readPipeText(proc.stderr),
151
+ // 超时保险丝:该路径历史上出过「进程不退出」类挂死(见上);超时 kill 后流关闭、
152
+ // Promise.all 收敛,-1 与真实非零退出一样走「无数据」降级。
153
+ new Promise((resolve2) => {
154
+ const timer = setTimeout(() => {
155
+ proc.kill();
156
+ resolve2(-1);
157
+ }, RUN_GIT_TIMEOUT_MS);
158
+ void proc.exited.then((code) => {
159
+ clearTimeout(timer);
160
+ resolve2(code);
161
+ });
162
+ })
147
163
  ]);
148
164
  if (exitCode !== 0) return null;
149
165
  return options.trim === false ? stdout.replace(/\r?\n$/, "") : stdout.trim();
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  toolRegistry
3
- } from "./chunk-BUWJ35JI.js";
3
+ } from "./chunk-QQBO3LQW.js";
4
4
  import {
5
5
  i18n_default
6
- } from "./chunk-KZNSQBYS.js";
6
+ } from "./chunk-J4R5XRX5.js";
7
7
  import {
8
8
  canonicalizeToolNames
9
9
  } from "./chunk-O6OSWFZQ.js";
@@ -8,7 +8,7 @@ import {
8
8
  readSseFrames,
9
9
  streamSseDataValues,
10
10
  throwIfChatCompletionStreamFailed
11
- } from "./chunk-HXAINXPQ.js";
11
+ } from "./chunk-QC5LGHYP.js";
12
12
  import {
13
13
  clipToolText,
14
14
  hasImageInRuntimeMessages,
@@ -20,8 +20,9 @@ import {
20
20
  import {
21
21
  downgradeUnparsableToolCalls,
22
22
  hasParsableObjectArguments,
23
+ repairTruncatedToolArguments,
23
24
  sanitizeForOutbound
24
- } from "./chunk-2QDDKFG5.js";
25
+ } from "./chunk-CQ3WA2NE.js";
25
26
  import {
26
27
  createThinkParserState,
27
28
  createToolCallAccumulator,
@@ -39,7 +40,7 @@ import {
39
40
  requiresBareImageUrl,
40
41
  resolveToolGuidedSections,
41
42
  toBareImageUrlMessages
42
- } from "./chunk-ZLPA7K55.js";
43
+ } from "./chunk-CPSZJBLK.js";
43
44
  import {
44
45
  convertMessagesToResponsesInput,
45
46
  extractReasoningFromResponseOutput,
@@ -50,15 +51,6 @@ import {
50
51
  toOpenAiCompatibleMessages,
51
52
  toResponsesTools
52
53
  } from "./chunk-PUOC4YRO.js";
53
- import {
54
- getAntigravityUserAgent,
55
- readAntigravityProjectId,
56
- resolveAntigravityCloudCodeBaseUrl
57
- } from "./chunk-PGSKWZCB.js";
58
- import {
59
- buildProviderAuthHeaders,
60
- buildProviderExecutionPlan
61
- } from "./chunk-CMH2SYHX.js";
62
54
  import {
63
55
  BRIDGE_STREAM_MAX_CHARS,
64
56
  DEFAULT_READ_DIALOG_MAX_RESPONSE_CHARS,
@@ -72,7 +64,16 @@ import {
72
64
  parseNoloWorkspaceToolArguments,
73
65
  readTextStreamUpToChars,
74
66
  resolveNoloDialogInput
75
- } from "./chunk-V3ZKNK5D.js";
67
+ } from "./chunk-ZVN6I33J.js";
68
+ import {
69
+ getAntigravityUserAgent,
70
+ readAntigravityProjectId,
71
+ resolveAntigravityCloudCodeBaseUrl
72
+ } from "./chunk-PGSKWZCB.js";
73
+ import {
74
+ buildProviderAuthHeaders,
75
+ buildProviderExecutionPlan
76
+ } from "./chunk-CMH2SYHX.js";
76
77
  import {
77
78
  buildDialogFallbackTitleFromUserInput
78
79
  } from "./chunk-2MBTWINN.js";
@@ -13966,9 +13967,17 @@ ${reasoningTailLog}
13966
13967
  try {
13967
13968
  const rawPoisonArguments = toolCall.function?.arguments;
13968
13969
  if (typeof rawPoisonArguments === "string" && rawPoisonArguments.trim() !== "" && !hasParsableObjectArguments(rawPoisonArguments)) {
13969
- throw new Error(
13970
- `\u6A21\u578B\u751F\u6210\u7684 tool_call arguments \u4E0D\u662F\u5408\u6CD5 JSON\uFF08\u7591\u4F3C\u4E0A\u6E38\u6D41\u5F0F\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${rawPoisonArguments.length}\uFF09\u3002\u8BF7\u91CD\u65B0\u5B8C\u6574\u8C03\u7528 ${toolName}\uFF0C\u786E\u4FDD arguments \u662F\u95ED\u5408\u7684 JSON \u5BF9\u8C61\uFF1B\u82E5\u56E0\u53C2\u6570\u8FC7\u957F\u88AB\u622A\u65AD\uFF0C\u5148\u7CBE\u7B80\u53C2\u6570\uFF08\u4E0D\u8981\u5185\u5D4C diff/\u65E5\u5FD7\u7B49\u5927\u6BB5\u6587\u672C\uFF0C\u6539\u4F20\u8DEF\u5F84\u8BA9\u5BF9\u65B9\u81EA\u884C\u8BFB\u53D6\uFF09\u518D\u91CD\u8BD5\u3002`
13971
- );
13970
+ const repairedArguments = repairTruncatedToolArguments(rawPoisonArguments);
13971
+ if (repairedArguments) {
13972
+ console.log(
13973
+ `[tool-args-repair] ${toolName}: \u8865\u5168\u88AB\u622A\u65AD\u7684 arguments\uFF08${rawPoisonArguments.length} \u2192 ${repairedArguments.length} \u5B57\u7B26\uFF0C\u5185\u5BB9\u96F6\u635F\u5931\uFF09`
13974
+ );
13975
+ toolCall.function.arguments = repairedArguments;
13976
+ } else {
13977
+ throw new Error(
13978
+ `\u6A21\u578B\u751F\u6210\u7684 tool_call arguments \u4E0D\u662F\u5408\u6CD5 JSON\uFF08\u7591\u4F3C\u4E0A\u6E38\u6D41\u5F0F\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${rawPoisonArguments.length}\uFF09\u3002\u8BF7\u91CD\u65B0\u5B8C\u6574\u8C03\u7528 ${toolName}\uFF0C\u786E\u4FDD arguments \u662F\u95ED\u5408\u7684 JSON \u5BF9\u8C61\uFF1B\u82E5\u56E0\u53C2\u6570\u8FC7\u957F\u88AB\u622A\u65AD\uFF0C\u5148\u7CBE\u7B80\u53C2\u6570\uFF08\u4E0D\u8981\u5185\u5D4C diff/\u65E5\u5FD7\u7B49\u5927\u6BB5\u6587\u672C\uFF0C\u6539\u4F20\u8DEF\u5F84\u8BA9\u5BF9\u65B9\u81EA\u884C\u8BFB\u53D6\uFF09\u518D\u91CD\u8BD5\u3002`
13979
+ );
13980
+ }
13972
13981
  }
13973
13982
  const writeTool = toolName === "writeFile" || toolName === "editFile";
13974
13983
  if (writeTool && input.onActionGate && input.fileWriteGateEnabled !== false) {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  buildAgentRuntimeAgentLookupKeys,
3
3
  shouldFetchAgentRuntimeRecordRemotely
4
- } from "./chunk-V3ZKNK5D.js";
4
+ } from "./chunk-ZVN6I33J.js";
5
5
 
6
6
  // packages/cli/client/localAgentRecords.ts
7
7
  var buildLocalAgentLookupKeys = buildAgentRuntimeAgentLookupKeys;