nolo-cli 0.71.0 → 0.72.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.
- package/{_executeModel-GOV2OHC7.js → _executeModel-T3FPYFVF.js} +11 -11
- package/{agentDeleteCommand-FSIMTL4K.js → agentDeleteCommand-UAMLWTPS.js} +6 -6
- package/{agentEmailCommands-YZQ2VVHY.js → agentEmailCommands-65FRADWQ.js} +15 -14
- package/{agentListCommands-2YWZYH52.js → agentListCommands-63DOSBY7.js} +7 -7
- package/{agentMachineCommands-UCYM5RRQ.js → agentMachineCommands-HMMAULDF.js} +6 -6
- package/{agentRecordCommands-TPBYOPMA.js → agentRecordCommands-HX5AEFP7.js} +15 -14
- package/{agentRunCommand-HBC2EQVU.js → agentRunCommand-KXPU5X7D.js} +15 -14
- package/{agentRuntimeLocal-O6DZDTK4.js → agentRuntimeLocal-XG3IDNOC.js} +4 -4
- package/{agentSlice-ZPODGT3P.js → agentSlice-EACXUOWW.js} +1 -1
- package/{appDeleteCommands-HIJNWSK7.js → appDeleteCommands-TJXDMOYT.js} +7 -7
- package/{appDeployCommands-XULV2ZN6.js → appDeployCommands-ECZJQAAL.js} +7 -7
- package/{appDeployStatusCommands-ETY4Z7K6.js → appDeployStatusCommands-DZKVFG3Y.js} +7 -7
- package/{appGetCommands-M253LKDA.js → appGetCommands-JIT4OPUD.js} +7 -7
- package/{appListCommands-XYFXJMNP.js → appListCommands-NR2HRMDY.js} +7 -7
- package/{chatQueueReduxAdapter-Z67OC4WO.js → chatQueueReduxAdapter-XEIJO5WR.js} +2 -2
- package/chromeCommands-VOIRNJBL.js +499 -0
- package/chromeOpsCommands-M7DPCX2T.js +258 -0
- package/{chunk-PWGW5JTK.js → chunk-226XC5JW.js} +2 -2
- package/{chunk-SPQ7GSUX.js → chunk-4SUTS5DI.js} +113 -16
- package/{chunk-B62OSA77.js → chunk-AFIKMMGC.js} +1 -1
- package/{chunk-Q4OT2DC7.js → chunk-AFIWC5NH.js} +1 -1
- package/{chunk-RFMPSCHX.js → chunk-AI5QKFXK.js} +5568 -337
- package/{chunk-NUTDASGX.js → chunk-ALGK6TIE.js} +2 -2
- package/{chunk-VLX45P4L.js → chunk-CDVGNZDA.js} +2 -2
- package/{chunk-2QDDKFG5.js → chunk-CQ3WA2NE.js} +77 -0
- package/{chunk-CJ23A7U4.js → chunk-CUQ6PG2C.js} +14 -5
- package/{chunk-ZIUMSKK4.js → chunk-D74EWXL4.js} +87 -47
- package/{chunk-JWO3RQSH.js → chunk-DWPNOYMB.js} +1 -1
- package/{chunk-EDKF7RX4.js → chunk-EOARMOVD.js} +2 -0
- package/{chunk-T7PQFKJU.js → chunk-FSFQ3A7S.js} +1 -1
- package/{chunk-YYLLD6H6.js → chunk-H5I6AJX4.js} +22 -6
- package/{chunk-3NVAU4WZ.js → chunk-H7UKKEIS.js} +1 -1
- package/{chunk-YCDWJX45.js → chunk-KC5FAHVS.js} +1 -1
- package/{chunk-3U3EA3BO.js → chunk-L2Y24GRM.js} +2 -2
- package/{chunk-FCCT2LU2.js → chunk-MEVSATIF.js} +61 -19
- package/{chunk-BLCUMZNV.js → chunk-P7FA2HMM.js} +66 -120
- package/{chunk-AUKZOZFG.js → chunk-QA6YKM3H.js} +1 -1
- package/{chunk-HXAINXPQ.js → chunk-QC5LGHYP.js} +1 -1
- package/chunk-QCZX4FTW.js +242 -0
- package/{chunk-DQAEUZSQ.js → chunk-QRBAZ5PW.js} +2 -2
- package/{chunk-F657NADX.js → chunk-QUH3XHL5.js} +3 -3
- package/{chunk-TVDZABBT.js → chunk-U6LKJRJB.js} +4 -4
- package/{chunk-IDZTNRP2.js → chunk-X7HHHIOZ.js} +10 -2
- package/{chunk-AAWBX67U.js → chunk-X7Z7U4Z6.js} +5 -5
- package/{contentThunks-VGXYTSKU.js → contentThunks-3SPROFG5.js} +3 -3
- package/{createAgentAutomationAction-6YBZFLET.js → createAgentAutomationAction-EIP2EG3O.js} +3 -3
- package/{createDialogAction-N7CTNKB5.js → createDialogAction-RLUSTN4D.js} +4 -4
- package/{createPageAction-RXOOVKVO.js → createPageAction-4Y52G7WG.js} +3 -3
- package/{dialogCommands-PE5FEFJ5.js → dialogCommands-CJCAMML3.js} +7 -7
- package/{dialogSlice-NLSKRXBN.js → dialogSlice-THY45JWM.js} +2 -2
- package/{docCreateCommands-IPDFZVPG.js → docCreateCommands-H65RSKT4.js} +6 -6
- package/{docDeleteCommands-VQ4Y66CM.js → docDeleteCommands-PBYGJ6CZ.js} +7 -7
- package/{docReadCommands-PD33VV27.js → docReadCommands-4VRYN5R5.js} +6 -6
- package/{docStore-CIAYE5WP.js → docStore-ZQ3ECOPY.js} +1 -1
- package/{docUpdateCommands-CGUQ2JY3.js → docUpdateCommands-COZG3ZDB.js} +6 -6
- package/{handleSendMessageAction-ENUNMW3Z.js → handleSendMessageAction-CE4M5XIE.js} +2 -2
- package/index.js +108 -48
- package/{machineCommands-APIJY7UA.js → machineCommands-JE4G4JYB.js} +14 -13
- package/{machineWsRunDispatch-42WKRDE7.js → machineWsRunDispatch-FUQOSWD4.js} +14 -13
- package/package.json +1 -1
- package/{readlineWorkspace-MUV7VRD4.js → readlineWorkspace-Z4V3EB52.js} +191 -57
- package/{runAgentClientLoop-A4OXYOCL.js → runAgentClientLoop-NE5EHXSS.js} +9 -9
- package/{spaceCommands-Y47DDAQD.js → spaceCommands-WGXHETMT.js} +6 -6
- package/{streamAgentChatTurn-YHKNJEFR.js → streamAgentChatTurn-A6L6O22P.js} +11 -11
- package/{tools-S5RSWF3R.js → tools-JS475NYO.js} +6 -6
- package/{tuiSummaryLlmCaller-J5BEPLW5.js → tuiSummaryLlmCaller-3Z24VUWM.js} +2 -2
- package/{updateCommands-AJYSD73Y.js → updateCommands-Y363MC3L.js} +2 -2
- package/{updateDialogTitleAction-BU2VPE5B.js → updateDialogTitleAction-GMZUT6RP.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
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4SUTS5DI.js";
|
|
4
4
|
import {
|
|
5
5
|
getReadableCliDb
|
|
6
6
|
} from "./chunk-RXX4GDIH.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveAgentRecordFromHybridStore,
|
|
13
13
|
sanitizeAgentRecordForCliOutput,
|
|
14
14
|
writeAgentRecord
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QA6YKM3H.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-SPAQ4PVV.js";
|
|
@@ -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";
|
|
@@ -55,11 +60,12 @@ import {
|
|
|
55
60
|
import {
|
|
56
61
|
inlineImageUrlsForCustomProvider,
|
|
57
62
|
prepareTools
|
|
58
|
-
} from "./chunk-
|
|
63
|
+
} from "./chunk-ALGK6TIE.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-
|
|
81
|
+
} from "./chunk-MEVSATIF.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-
|
|
104
|
+
} from "./chunk-D74EWXL4.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-
|
|
110
|
+
} from "./chunk-QUH3XHL5.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-
|
|
162
|
+
} from "./chunk-CUQ6PG2C.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-
|
|
174
|
+
} from "./chunk-QC5LGHYP.js";
|
|
169
175
|
import {
|
|
170
176
|
resolveAgentRuntimeConfigFromRecord,
|
|
171
177
|
resolveHistoricalToolContentCap
|
|
@@ -799,28 +805,40 @@ var STRINGS = {
|
|
|
799
805
|
zh: "\u63D0\u4EA4 \u2193"
|
|
800
806
|
},
|
|
801
807
|
askChoiceSubmitRow: {
|
|
802
|
-
en: "
|
|
803
|
-
zh: "\
|
|
808
|
+
en: "Done",
|
|
809
|
+
zh: "\u5B8C\u6210"
|
|
810
|
+
},
|
|
811
|
+
askChoiceSkipRow: {
|
|
812
|
+
en: "Skip",
|
|
813
|
+
zh: "\u8DF3\u8FC7"
|
|
804
814
|
},
|
|
805
815
|
askChoiceOtherLabel: {
|
|
806
816
|
en: "Other",
|
|
807
817
|
zh: "\u5176\u4ED6"
|
|
808
818
|
},
|
|
809
819
|
askChoiceHintSingle: {
|
|
810
|
-
en: "Enter/Space picks \xB7
|
|
811
|
-
zh: "Enter/\u7A7A\u683C \u9009\u62E9
|
|
820
|
+
en: "Enter/Space picks \xB7 single question sends \xB7 multi-question jumps to the next unanswered \xB7 Enter in Other confirms and continues",
|
|
821
|
+
zh: "Enter/\u7A7A\u683C \u9009\u62E9\uFF1A\u5355\u9898\u76F4\u63A5\u53D1\u9001\u3001\u591A\u9898\u8DF3\u5230\u4E0B\u4E00\u672A\u7B54\u9898 \xB7 \u5176\u4ED6\u8F93\u5165\u540E Enter \u786E\u8BA4\u5E76\u7EE7\u7EED"
|
|
822
|
+
},
|
|
823
|
+
askChoiceHintOptional: {
|
|
824
|
+
en: "Optional question \u2014 Enter/Space picks (one step) \xB7 skip if you don't want to answer",
|
|
825
|
+
zh: "\u53EF\u9009\u9898 \u2014 Enter/\u7A7A\u683C \u9009\u62E9\u5373\u5B8C\u6210 \xB7 \u4E0D\u60F3\u56DE\u7B54\u53EF\u8DF3\u8FC7"
|
|
812
826
|
},
|
|
813
827
|
askChoiceHintMulti: {
|
|
814
|
-
en: "Enter/Space toggles \xB7 \u2193 to
|
|
815
|
-
zh: "Enter/\u7A7A\u683C \u5207\u6362\u9009\u4E2D \xB7 \u2193 \u5230\
|
|
828
|
+
en: "Enter/Space toggles \xB7 \u2193 to Done row, Enter sends",
|
|
829
|
+
zh: "Enter/\u7A7A\u683C \u5207\u6362\u9009\u4E2D \xB7 \u2193 \u5230\u5B8C\u6210\u884C Enter \u53D1\u9001"
|
|
816
830
|
},
|
|
817
831
|
askChoiceFooterSingle: {
|
|
818
|
-
en: "\u21B5
|
|
819
|
-
zh: "\u21B5 \u9009\u62E9
|
|
832
|
+
en: "\u21B5 pick/send \xB7 tab switch \xB7 esc cancel",
|
|
833
|
+
zh: "\u21B5 \u9009\u62E9/\u53D1\u9001 \xB7 tab \u5207\u6362 \xB7 esc \u53D6\u6D88"
|
|
834
|
+
},
|
|
835
|
+
askChoiceFooterSkip: {
|
|
836
|
+
en: "\u21B5 pick/send \xB7 \u2193 skip row \u21B5 skip \xB7 tab switch \xB7 esc cancel",
|
|
837
|
+
zh: "\u21B5 \u9009\u62E9/\u53D1\u9001 \xB7 \u2193 \u8DF3\u8FC7\u884C \u21B5 \u8DF3\u8FC7 \xB7 tab \u5207\u6362 \xB7 esc \u53D6\u6D88"
|
|
820
838
|
},
|
|
821
839
|
askChoiceFooterMulti: {
|
|
822
|
-
en: "\u21B5 toggle \xB7 \u2193
|
|
823
|
-
zh: "\u21B5 \u5207\u6362 \xB7 \u2193 \
|
|
840
|
+
en: "\u21B5 toggle \xB7 \u2193 done row \u21B5 send \xB7 ctrl+s send \xB7 tab switch \xB7 esc cancel",
|
|
841
|
+
zh: "\u21B5 \u5207\u6362 \xB7 \u2193 \u5B8C\u6210\u884C \u21B5 \u53D1\u9001 \xB7 ctrl+s \u53D1\u9001 \xB7 tab \u5207\u6362 \xB7 esc \u53D6\u6D88"
|
|
824
842
|
},
|
|
825
843
|
askChoiceValidationRequired: {
|
|
826
844
|
en: "Required questions are unanswered \u2014 jumped to the first one.",
|
|
@@ -1660,6 +1678,17 @@ var LOCAL_SERVER_MEMORY_TOOL_NAME_SET = new Set(
|
|
|
1660
1678
|
);
|
|
1661
1679
|
|
|
1662
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
|
+
}
|
|
1663
1692
|
function buildOpenAiTools(args) {
|
|
1664
1693
|
const toolset = buildLocalWorkspaceToolsetForEnv(args);
|
|
1665
1694
|
const workspaceToolNames = toolset.toolNames;
|
|
@@ -1707,6 +1736,7 @@ function buildOpenAiTools(args) {
|
|
|
1707
1736
|
toolNames: args.effectiveToolNames ?? workspaceToolNames,
|
|
1708
1737
|
exposeShellTools: toolset.exposeShellTools
|
|
1709
1738
|
}),
|
|
1739
|
+
...buildCliChromeConnectorOpenAiTools({ toolNames: args.toolNames }),
|
|
1710
1740
|
...buildServerPlatformOpenAiTools({ toolNames: args.toolNames }),
|
|
1711
1741
|
...buildNoloWorkspaceOpenAiTools({ toolNames: args.toolNames }),
|
|
1712
1742
|
...buildOrchestrationOpenAiTools({
|
|
@@ -2512,6 +2542,46 @@ async function detectCurrentMachineId(env) {
|
|
|
2512
2542
|
}
|
|
2513
2543
|
|
|
2514
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
|
+
}
|
|
2515
2585
|
function buildDelegatedTaskContent(task, input) {
|
|
2516
2586
|
if (input === void 0 || input === null) {
|
|
2517
2587
|
return task;
|
|
@@ -2528,6 +2598,9 @@ ${input}`;
|
|
|
2528
2598
|
}
|
|
2529
2599
|
let jsonStr;
|
|
2530
2600
|
try {
|
|
2601
|
+
if (hasJsonCycle(input)) {
|
|
2602
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
2603
|
+
}
|
|
2531
2604
|
const serialized = JSON.stringify(input, null, 2);
|
|
2532
2605
|
if (serialized === void 0) {
|
|
2533
2606
|
return task;
|
|
@@ -2552,6 +2625,9 @@ function calculateDelegatedPayloadMetrics(task, input, delegatedContent) {
|
|
|
2552
2625
|
serializedInputForTokens = input;
|
|
2553
2626
|
} else {
|
|
2554
2627
|
try {
|
|
2628
|
+
if (hasJsonCycle(input)) {
|
|
2629
|
+
throw new TypeError("Converting circular structure to JSON");
|
|
2630
|
+
}
|
|
2555
2631
|
const serialized = JSON.stringify(input, null, 2);
|
|
2556
2632
|
if (serialized !== void 0) {
|
|
2557
2633
|
inputChars = serialized.length;
|
|
@@ -11259,6 +11335,19 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
11259
11335
|
};
|
|
11260
11336
|
}
|
|
11261
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
|
+
|
|
11262
11351
|
// packages/cli/client/cliLocalToolExecutors.ts
|
|
11263
11352
|
var MAX_PASTED_TEXT_LINES_PER_READ = 200;
|
|
11264
11353
|
var PASTED_TEXT_EXPLICIT_OVERSHOOT_LINES = 20;
|
|
@@ -11545,6 +11634,12 @@ function buildLocalToolExecutors(args) {
|
|
|
11545
11634
|
};
|
|
11546
11635
|
},
|
|
11547
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
|
+
),
|
|
11548
11643
|
...args.localToolExecutors ?? {}
|
|
11549
11644
|
};
|
|
11550
11645
|
}
|
|
@@ -12377,6 +12472,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
12377
12472
|
workspaceRoot,
|
|
12378
12473
|
env: deps.env,
|
|
12379
12474
|
fetchImpl,
|
|
12475
|
+
...deps.chromeConnectorClient ? { chromeConnectorClient: deps.chromeConnectorClient } : {},
|
|
12380
12476
|
localToolExecutors: deps.localToolExecutors,
|
|
12381
12477
|
readXPost: deps.readXPost,
|
|
12382
12478
|
readXhsProfile: deps.readXhsProfile,
|
|
@@ -12453,6 +12549,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
12453
12549
|
workspaceRoot,
|
|
12454
12550
|
env: deps.env,
|
|
12455
12551
|
fetchImpl,
|
|
12552
|
+
...deps.chromeConnectorClient ? { chromeConnectorClient: deps.chromeConnectorClient } : {},
|
|
12456
12553
|
localToolExecutors: deps.localToolExecutors,
|
|
12457
12554
|
readXPost: deps.readXPost,
|
|
12458
12555
|
readXhsProfile: deps.readXhsProfile,
|