nolo-cli 0.74.0-alpha.1 → 0.75.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.
- package/{_executeModel-YEVZAJYX.js → _executeModel-CNEEELFV.js} +10 -10
- package/{agentDeleteCommand-FSIMTL4K.js → agentDeleteCommand-WVO3JTH6.js} +4 -4
- package/{agentEmailCommands-HQT4EUOA.js → agentEmailCommands-VX5OYTHG.js} +13 -12
- package/{agentListCommands-2YWZYH52.js → agentListCommands-XWLQZ2ZH.js} +5 -5
- package/{agentMachineCommands-3TR7DVYO.js → agentMachineCommands-IG6KJFNN.js} +4 -4
- package/{agentRecordCommands-TRUY7Z6N.js → agentRecordCommands-V5LRQDDX.js} +13 -12
- package/{agentRunCommand-EHJOESHA.js → agentRunCommand-RUUOF2DY.js} +13 -12
- package/{agentSlice-RRZS2UII.js → agentSlice-S3JFDTH4.js} +1 -1
- package/{appDeleteCommands-HIJNWSK7.js → appDeleteCommands-426QK2XG.js} +5 -5
- package/{appDeployCommands-XULV2ZN6.js → appDeployCommands-FIGFGXIJ.js} +5 -5
- package/{appDeployStatusCommands-ETY4Z7K6.js → appDeployStatusCommands-D3B235FQ.js} +5 -5
- package/{appGetCommands-M253LKDA.js → appGetCommands-U6RZJII4.js} +5 -5
- package/{appListCommands-XYFXJMNP.js → appListCommands-732PFEWM.js} +5 -5
- package/{chatQueueReduxAdapter-LSBTGZW2.js → chatQueueReduxAdapter-CHJZ2O2P.js} +2 -2
- package/chromeCommands-VOIRNJBL.js +499 -0
- package/chromeOpsCommands-M7DPCX2T.js +258 -0
- package/{chunk-FARB62OB.js → chunk-5WUTIRKL.js} +7 -7
- package/{chunk-TI4CCL34.js → chunk-6RUYWJXO.js} +3 -3
- package/{chunk-B62OSA77.js → chunk-AFIKMMGC.js} +1 -1
- package/{chunk-Q4OT2DC7.js → chunk-AFIWC5NH.js} +1 -1
- package/{chunk-57VRXRLF.js → chunk-BNLAGFPO.js} +1 -1
- package/{chunk-QBA5KMJI.js → chunk-D42DMWKD.js} +22 -8
- package/{chunk-XGZM6BTX.js → chunk-DDWYTB5N.js} +1 -1
- package/{chunk-JWO3RQSH.js → chunk-DWPNOYMB.js} +1 -1
- package/{chunk-T7PQFKJU.js → chunk-FSFQ3A7S.js} +1 -1
- package/{chunk-AWPU7GXU.js → chunk-ITFKTCHH.js} +2 -2
- package/{chunk-YCDWJX45.js → chunk-KC5FAHVS.js} +1 -1
- package/{chunk-I4UWPYBH.js → chunk-KG7ANYLN.js} +2 -2
- package/{chunk-3U3EA3BO.js → chunk-L2Y24GRM.js} +2 -2
- package/{chunk-OXY5PKLG.js → chunk-MWV66JTV.js} +2 -2
- package/{chunk-XPQJXIF5.js → chunk-NU6FRRNU.js} +43 -4
- package/{chunk-VOEW2KF3.js → chunk-PEBKIEA5.js} +8 -8
- package/{chunk-AUKZOZFG.js → chunk-QA6YKM3H.js} +1 -1
- package/chunk-QCZX4FTW.js +242 -0
- package/{chunk-OH5WRY7G.js → chunk-RUX46F4O.js} +16 -4
- package/{chunk-2JCTE5UN.js → chunk-WD4SMAPR.js} +2 -2
- package/{chunk-IDZTNRP2.js → chunk-X7HHHIOZ.js} +10 -2
- package/{chunk-DFY6PUV4.js → chunk-ZHIOJU46.js} +5 -5
- package/{chunk-CS36XM4N.js → chunk-ZNZCVXRV.js} +3 -3
- package/{contentThunks-476Y6CFR.js → contentThunks-P73Q4WUM.js} +3 -3
- package/{createAgentAutomationAction-DN4SFTP5.js → createAgentAutomationAction-JLHVMB4X.js} +3 -3
- package/{createDialogAction-2GS4JCMU.js → createDialogAction-6ZKSFM5O.js} +4 -4
- package/{createPageAction-44WTUMZ5.js → createPageAction-MN4VOJYH.js} +3 -3
- package/{dialogCommands-PE5FEFJ5.js → dialogCommands-7FH6Z2YK.js} +5 -5
- package/{dialogSlice-7HEVCJFT.js → dialogSlice-P2G3GRRG.js} +2 -2
- package/{docCreateCommands-IPDFZVPG.js → docCreateCommands-GN5E5ULM.js} +4 -4
- package/{docDeleteCommands-VQ4Y66CM.js → docDeleteCommands-OQWPPQME.js} +5 -5
- package/{docReadCommands-PD33VV27.js → docReadCommands-E4QK2223.js} +4 -4
- package/{docStore-LJ7KNKFB.js → docStore-GUHCPV37.js} +1 -1
- package/{docUpdateCommands-CGUQ2JY3.js → docUpdateCommands-ZDJE4SI7.js} +4 -4
- package/{handleSendMessageAction-ETA5QZIN.js → handleSendMessageAction-NLDMT3LZ.js} +2 -2
- package/index.js +107 -47
- package/{machineCommands-INAP62WH.js → machineCommands-BCCBSQQR.js} +12 -11
- package/{machineWsRunDispatch-MT7VRNKX.js → machineWsRunDispatch-7FMVGMI6.js} +12 -11
- package/package.json +1 -1
- package/{readlineWorkspace-5TV6ES57.js → readlineWorkspace-S5ZQIVWS.js} +17 -16
- package/{runAgentClientLoop-2PGZSCET.js → runAgentClientLoop-UANNODBO.js} +8 -8
- package/{spaceCommands-Y47DDAQD.js → spaceCommands-GSQCO2LI.js} +4 -4
- package/{streamAgentChatTurn-I6FUM6RV.js → streamAgentChatTurn-76WFI2YK.js} +9 -9
- package/{tools-KU4X5HGZ.js → tools-XJGU2HAF.js} +6 -6
- package/{updateCommands-AJYSD73Y.js → updateCommands-Y363MC3L.js} +2 -2
- package/{updateDialogTitleAction-E3SNB75W.js → updateDialogTitleAction-5BHRK2XV.js} +3 -3
- package/{agentRuntimeLocal-O6DZDTK4.js → agentRuntimeLocal-ZSUEMWRL.js} +1 -1
|
@@ -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-KG7ANYLN.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-D42DMWKD.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-PEBKIEA5.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-6RUYWJXO.js";
|
|
105
111
|
import {
|
|
106
112
|
require_date_fns
|
|
107
113
|
} from "./chunk-M76ECQRD.js";
|
|
@@ -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({
|
|
@@ -11317,6 +11335,19 @@ function createCliControlAgentRunExecutor(deps = {}) {
|
|
|
11317
11335
|
};
|
|
11318
11336
|
}
|
|
11319
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
|
+
|
|
11320
11351
|
// packages/cli/client/cliLocalToolExecutors.ts
|
|
11321
11352
|
var MAX_PASTED_TEXT_LINES_PER_READ = 200;
|
|
11322
11353
|
var PASTED_TEXT_EXPLICIT_OVERSHOOT_LINES = 20;
|
|
@@ -11603,6 +11634,12 @@ function buildLocalToolExecutors(args) {
|
|
|
11603
11634
|
};
|
|
11604
11635
|
},
|
|
11605
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
|
+
),
|
|
11606
11643
|
...args.localToolExecutors ?? {}
|
|
11607
11644
|
};
|
|
11608
11645
|
}
|
|
@@ -12435,6 +12472,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
12435
12472
|
workspaceRoot,
|
|
12436
12473
|
env: deps.env,
|
|
12437
12474
|
fetchImpl,
|
|
12475
|
+
...deps.chromeConnectorClient ? { chromeConnectorClient: deps.chromeConnectorClient } : {},
|
|
12438
12476
|
localToolExecutors: deps.localToolExecutors,
|
|
12439
12477
|
readXPost: deps.readXPost,
|
|
12440
12478
|
readXhsProfile: deps.readXhsProfile,
|
|
@@ -12511,6 +12549,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
12511
12549
|
workspaceRoot,
|
|
12512
12550
|
env: deps.env,
|
|
12513
12551
|
fetchImpl,
|
|
12552
|
+
...deps.chromeConnectorClient ? { chromeConnectorClient: deps.chromeConnectorClient } : {},
|
|
12514
12553
|
localToolExecutors: deps.localToolExecutors,
|
|
12515
12554
|
readXPost: deps.readXPost,
|
|
12516
12555
|
readXhsProfile: deps.readXhsProfile,
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
} from "./chunk-AGGIDPCZ.js";
|
|
14
14
|
import {
|
|
15
15
|
runLlm
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-6RUYWJXO.js";
|
|
17
17
|
import {
|
|
18
18
|
cleanupCliSessionForDialog
|
|
19
19
|
} from "./chunk-BJCWNHVU.js";
|
|
@@ -17122,7 +17122,7 @@ var messageSlice = createSliceWithThunks({
|
|
|
17122
17122
|
runtimeOptions: args.runtimeOptions
|
|
17123
17123
|
});
|
|
17124
17124
|
if (agentKeyToUse) {
|
|
17125
|
-
const { streamAgentChatTurn } = await import("./agentSlice-
|
|
17125
|
+
const { streamAgentChatTurn } = await import("./agentSlice-S3JFDTH4.js");
|
|
17126
17126
|
await dispatch(
|
|
17127
17127
|
streamAgentChatTurn({
|
|
17128
17128
|
agentKey: agentKeyToUse,
|
|
@@ -18255,7 +18255,7 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
18255
18255
|
}
|
|
18256
18256
|
if (isCurrentDialog) {
|
|
18257
18257
|
await thunkApi.dispatch(resetMsgs());
|
|
18258
|
-
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-
|
|
18258
|
+
const { clearPendingAttachments: clearPendingAttachments2 } = await import("./dialogSlice-P2G3GRRG.js");
|
|
18259
18259
|
dispatch(clearPendingAttachments2());
|
|
18260
18260
|
}
|
|
18261
18261
|
return { dialogKey, isCurrentDialog, attachmentPlan };
|
|
@@ -18263,15 +18263,15 @@ var deleteDialogThunk = async (payload, thunkApi) => {
|
|
|
18263
18263
|
|
|
18264
18264
|
// packages/chat/dialog/dialogSlice.ts
|
|
18265
18265
|
var runCreateDialogAction = async (args, thunkApi) => {
|
|
18266
|
-
const { createDialogAction } = await import("./createDialogAction-
|
|
18266
|
+
const { createDialogAction } = await import("./createDialogAction-6ZKSFM5O.js");
|
|
18267
18267
|
return createDialogAction(args, thunkApi);
|
|
18268
18268
|
};
|
|
18269
18269
|
var runCreateAgentAutomationAction = async (args, thunkApi) => {
|
|
18270
|
-
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-
|
|
18270
|
+
const { createAgentAutomationAction } = await import("./createAgentAutomationAction-JLHVMB4X.js");
|
|
18271
18271
|
return createAgentAutomationAction(args, thunkApi);
|
|
18272
18272
|
};
|
|
18273
18273
|
var runUpdateDialogTitleAction = async (args, thunkApi) => {
|
|
18274
|
-
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-
|
|
18274
|
+
const { updateDialogTitleAction } = await import("./updateDialogTitleAction-5BHRK2XV.js");
|
|
18275
18275
|
return updateDialogTitleAction(args, thunkApi);
|
|
18276
18276
|
};
|
|
18277
18277
|
var runAddDialogAgentAction = async (args, thunkApi) => {
|
|
@@ -18295,7 +18295,7 @@ var runSetDialogExtraReferencesAction = async (args, thunkApi) => {
|
|
|
18295
18295
|
return setDialogExtraReferencesAction(args, thunkApi);
|
|
18296
18296
|
};
|
|
18297
18297
|
var runHandleSendMessageAction = async (args, thunkApi) => {
|
|
18298
|
-
const { handleSendMessageAction } = await import("./handleSendMessageAction-
|
|
18298
|
+
const { handleSendMessageAction } = await import("./handleSendMessageAction-NLDMT3LZ.js");
|
|
18299
18299
|
return handleSendMessageAction(args, thunkApi);
|
|
18300
18300
|
};
|
|
18301
18301
|
function clearDialogState() {
|
|
@@ -18308,7 +18308,7 @@ var createPageAndAddReference = createAsyncThunk(
|
|
|
18308
18308
|
async (payload, { dispatch, getState, rejectWithValue }) => {
|
|
18309
18309
|
const { slateData, jsonData, title, type, fileId, groupId, dialogKey } = payload;
|
|
18310
18310
|
try {
|
|
18311
|
-
const { createDocState } = await import("./docStore-
|
|
18311
|
+
const { createDocState } = await import("./docStore-GUHCPV37.js");
|
|
18312
18312
|
const pageKey = await createDocState(
|
|
18313
18313
|
{ slateData, title },
|
|
18314
18314
|
{ dispatch, getState }
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
import {
|
|
2
|
+
toErrorMessage
|
|
3
|
+
} from "./chunk-HNMXYYJR.js";
|
|
4
|
+
import {
|
|
5
|
+
isRecord
|
|
6
|
+
} from "./chunk-KUG52IAP.js";
|
|
7
|
+
|
|
8
|
+
// packages/desktop-chrome-connector/chromeConnector.ts
|
|
9
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
10
|
+
import { resolve } from "node:path";
|
|
11
|
+
var NOLO_CHROME_CONNECTOR_EXTENSION_ID = "ahpdoopadkamnglhlacfjdfnonpjdplg";
|
|
12
|
+
var NOLO_CHROME_CONNECTOR_PROTOCOL_VERSION = "2";
|
|
13
|
+
function defaultTokenPath() {
|
|
14
|
+
return resolve(
|
|
15
|
+
process.env.HOME || "",
|
|
16
|
+
"Library/Application Support/Nolo/ChromeConnector/token"
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
function readConnectorToken(tokenPath = defaultTokenPath()) {
|
|
20
|
+
if (process.env.NOLO_CHROME_CONNECTOR_TOKEN) return process.env.NOLO_CHROME_CONNECTOR_TOKEN;
|
|
21
|
+
if (!existsSync(tokenPath)) return "";
|
|
22
|
+
return readFileSync(tokenPath, "utf8").trim();
|
|
23
|
+
}
|
|
24
|
+
var CHROME_TOOL_ACTIONS = {
|
|
25
|
+
chrome_list_tabs: "list_tabs",
|
|
26
|
+
chrome_open_tab: "open_tab",
|
|
27
|
+
chrome_close_tab: "close_tab",
|
|
28
|
+
chrome_read_page: "read_page",
|
|
29
|
+
chrome_click: "click",
|
|
30
|
+
chrome_type: "type",
|
|
31
|
+
chrome_press: "press",
|
|
32
|
+
chrome_scroll: "scroll",
|
|
33
|
+
chrome_screenshot: "screenshot",
|
|
34
|
+
chrome_read_console: "read_console",
|
|
35
|
+
chrome_read_network: "read_network"
|
|
36
|
+
};
|
|
37
|
+
function createConnectorError(code, message, details) {
|
|
38
|
+
const error = new Error(message);
|
|
39
|
+
error.code = code;
|
|
40
|
+
if (details !== void 0) error.details = details;
|
|
41
|
+
return error;
|
|
42
|
+
}
|
|
43
|
+
function parseArguments(raw) {
|
|
44
|
+
try {
|
|
45
|
+
const parsed = JSON.parse(raw || "{}");
|
|
46
|
+
if (!isRecord(parsed)) {
|
|
47
|
+
throw createConnectorError("INVALID_ARGUMENTS", "Chrome connector tool arguments must be a JSON object.");
|
|
48
|
+
}
|
|
49
|
+
return parsed;
|
|
50
|
+
} catch (error) {
|
|
51
|
+
if (error.code) throw error;
|
|
52
|
+
throw createConnectorError("INVALID_ARGUMENTS", "Chrome connector tool arguments must be valid JSON.");
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
function errorPayload(error) {
|
|
56
|
+
return {
|
|
57
|
+
code: error?.code ?? "CHROME_CONNECTOR_ERROR",
|
|
58
|
+
message: toErrorMessage(error),
|
|
59
|
+
...error?.details !== void 0 ? { details: error.details } : {}
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
var TARGET_REQUIRED_ACTIONS = /* @__PURE__ */ new Set(["click", "type"]);
|
|
63
|
+
var TAB_ID_REQUIRED_ACTIONS = /* @__PURE__ */ new Set(["close_tab", "detach"]);
|
|
64
|
+
function validateChromeConnectorPayload(action, payload) {
|
|
65
|
+
if (TAB_ID_REQUIRED_ACTIONS.has(action)) {
|
|
66
|
+
const raw = payload.tabId;
|
|
67
|
+
const tabId = typeof raw === "string" ? raw.trim() : typeof raw === "number" && Number.isFinite(raw) ? String(raw) : "";
|
|
68
|
+
if (!tabId) {
|
|
69
|
+
throw createConnectorError(
|
|
70
|
+
"TAB_ID_REQUIRED",
|
|
71
|
+
`Provide the tabId from chrome_list_tabs before calling ${action}.`
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!TARGET_REQUIRED_ACTIONS.has(action)) return;
|
|
77
|
+
const elementRef = typeof payload.elementRef === "string" ? payload.elementRef.trim() : "";
|
|
78
|
+
const selector = typeof payload.selector === "string" ? payload.selector.trim() : "";
|
|
79
|
+
if (elementRef || selector) return;
|
|
80
|
+
throw createConnectorError(
|
|
81
|
+
"ELEMENT_TARGET_REQUIRED",
|
|
82
|
+
"Provide elementRef from chrome_read_page or a CSS selector."
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
function createChromeConnectorClient(args) {
|
|
86
|
+
if (args?.request) return { request: args.request };
|
|
87
|
+
const defaultPort = process.env.NOLO_CHROME_CONNECTOR_PORT || "38947";
|
|
88
|
+
const endpoint = args?.endpoint ?? process.env.NOLO_CHROME_CONNECTOR_RPC_URL ?? `http://127.0.0.1:${defaultPort}/rpc`;
|
|
89
|
+
const fetchImpl = args?.fetchImpl ?? fetch;
|
|
90
|
+
const token = args?.token ?? readConnectorToken(args?.tokenPath);
|
|
91
|
+
return {
|
|
92
|
+
async request(action, payload) {
|
|
93
|
+
let response;
|
|
94
|
+
try {
|
|
95
|
+
response = await fetchImpl(endpoint, {
|
|
96
|
+
method: "POST",
|
|
97
|
+
headers: {
|
|
98
|
+
"Content-Type": "application/json",
|
|
99
|
+
...token ? { "X-Nolo-Chrome-Connector-Token": token } : {}
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify({ action, payload })
|
|
102
|
+
});
|
|
103
|
+
} catch (error) {
|
|
104
|
+
throw createConnectorError(
|
|
105
|
+
"CHROME_CONNECTOR_UNAVAILABLE",
|
|
106
|
+
`Chrome connector RPC endpoint is unavailable at ${endpoint}.`,
|
|
107
|
+
{ cause: toErrorMessage(error) }
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
const data = await response.json().catch(() => ({}));
|
|
111
|
+
if (!response.ok || data?.ok === false) {
|
|
112
|
+
throw createConnectorError(
|
|
113
|
+
typeof data?.error?.code === "string" ? data.error.code : "CHROME_CONNECTOR_RPC_ERROR",
|
|
114
|
+
typeof data?.error?.message === "string" ? data.error.message : `Chrome connector RPC failed with HTTP ${response.status}.`,
|
|
115
|
+
data?.error?.details
|
|
116
|
+
);
|
|
117
|
+
}
|
|
118
|
+
return data?.result;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
var REQUIRED_CHROME_CONNECTOR_FEATURES = {
|
|
123
|
+
list_tabs: ["tabs"],
|
|
124
|
+
open_tab: ["tabs"],
|
|
125
|
+
close_tab: ["tabs"],
|
|
126
|
+
read_page: ["compact_observation_v2"],
|
|
127
|
+
click: ["compact_observation_v2", "action_gate"],
|
|
128
|
+
type: ["compact_observation_v2", "action_gate"],
|
|
129
|
+
press: ["compact_observation_v2", "action_gate"],
|
|
130
|
+
scroll: ["compact_observation_v2"],
|
|
131
|
+
screenshot: ["browser_debug"],
|
|
132
|
+
read_console: ["browser_debug"],
|
|
133
|
+
read_network: ["browser_debug"],
|
|
134
|
+
detach: ["browser_debug"]
|
|
135
|
+
};
|
|
136
|
+
function requiredFeaturesForConnectorAction(action) {
|
|
137
|
+
return [...REQUIRED_CHROME_CONNECTOR_FEATURES[action] ?? []];
|
|
138
|
+
}
|
|
139
|
+
function createVerifiedChromeConnectorClient(args) {
|
|
140
|
+
const client = args?.client ?? createChromeConnectorClient();
|
|
141
|
+
const expectedExtensionId = args?.expectedExtensionId ?? NOLO_CHROME_CONNECTOR_EXTENSION_ID;
|
|
142
|
+
let verified = null;
|
|
143
|
+
let negotiatedFeatures = [];
|
|
144
|
+
const verify = async () => {
|
|
145
|
+
const connectorInfo = await client.request("connector_info", {});
|
|
146
|
+
const receivedExtensionId = connectorInfo?.extensionId;
|
|
147
|
+
if (receivedExtensionId !== expectedExtensionId) {
|
|
148
|
+
throw createConnectorError(
|
|
149
|
+
"CHROME_CONNECTOR_EXTENSION_MISMATCH",
|
|
150
|
+
`Chrome connector extension id mismatch: expected ${expectedExtensionId}, received ${typeof receivedExtensionId === "string" ? receivedExtensionId : "unknown"}.`,
|
|
151
|
+
{ expectedExtensionId, receivedExtensionId }
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
const receivedProtocolVersion = connectorInfo?.protocolVersion;
|
|
155
|
+
if (receivedProtocolVersion !== NOLO_CHROME_CONNECTOR_PROTOCOL_VERSION) {
|
|
156
|
+
throw createConnectorError(
|
|
157
|
+
"CHROME_CONNECTOR_PROTOCOL_MISMATCH",
|
|
158
|
+
`Chrome connector protocol mismatch: expected ${NOLO_CHROME_CONNECTOR_PROTOCOL_VERSION}, received ${typeof receivedProtocolVersion === "string" ? receivedProtocolVersion : "unknown"}. Reload the Nolo Desktop Chrome Connector extension.`,
|
|
159
|
+
{
|
|
160
|
+
expectedProtocolVersion: NOLO_CHROME_CONNECTOR_PROTOCOL_VERSION,
|
|
161
|
+
receivedProtocolVersion
|
|
162
|
+
}
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
const rawFeatures = connectorInfo?.features;
|
|
166
|
+
negotiatedFeatures = Array.isArray(rawFeatures) ? rawFeatures.filter((entry) => typeof entry === "string") : [];
|
|
167
|
+
};
|
|
168
|
+
return {
|
|
169
|
+
async request(action, payload) {
|
|
170
|
+
verified ??= verify().catch((error) => {
|
|
171
|
+
verified = null;
|
|
172
|
+
throw error;
|
|
173
|
+
});
|
|
174
|
+
await verified;
|
|
175
|
+
const missing = requiredFeaturesForConnectorAction(action).filter(
|
|
176
|
+
(feature) => !negotiatedFeatures.includes(feature)
|
|
177
|
+
);
|
|
178
|
+
if (missing.length > 0) {
|
|
179
|
+
throw createConnectorError(
|
|
180
|
+
"CAPABILITY_UNSUPPORTED",
|
|
181
|
+
`The installed Nolo Browser Connector extension does not support ${missing.join(", ")} (needed by ${action}). Reload or update the extension, then try again.`,
|
|
182
|
+
{ action, missingFeatures: missing, requiredFeatures: requiredFeaturesForConnectorAction(action), features: [...negotiatedFeatures] }
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
return client.request(action, payload);
|
|
186
|
+
},
|
|
187
|
+
features() {
|
|
188
|
+
return [...negotiatedFeatures];
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
async function executeChromeConnectorTool(args) {
|
|
193
|
+
const action = CHROME_TOOL_ACTIONS[args.call.name];
|
|
194
|
+
if (!action) {
|
|
195
|
+
return {
|
|
196
|
+
content: JSON.stringify({
|
|
197
|
+
ok: false,
|
|
198
|
+
error: {
|
|
199
|
+
code: "UNKNOWN_CHROME_TOOL",
|
|
200
|
+
message: `Unknown Chrome connector tool: ${args.call.name}`
|
|
201
|
+
}
|
|
202
|
+
}),
|
|
203
|
+
metadata: {
|
|
204
|
+
chromeConnector: true,
|
|
205
|
+
error: true,
|
|
206
|
+
code: "UNKNOWN_CHROME_TOOL"
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
try {
|
|
211
|
+
const payload = parseArguments(args.call.arguments);
|
|
212
|
+
validateChromeConnectorPayload(action, payload);
|
|
213
|
+
const result = await (args.client ?? createChromeConnectorClient()).request(action, payload);
|
|
214
|
+
return {
|
|
215
|
+
content: JSON.stringify({ ok: true, result }),
|
|
216
|
+
metadata: {
|
|
217
|
+
chromeConnector: true,
|
|
218
|
+
action
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
} catch (error) {
|
|
222
|
+
const payload = errorPayload(error);
|
|
223
|
+
return {
|
|
224
|
+
content: JSON.stringify({ ok: false, error: payload }),
|
|
225
|
+
metadata: {
|
|
226
|
+
chromeConnector: true,
|
|
227
|
+
error: true,
|
|
228
|
+
code: payload.code
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
var CHROME_CONNECTOR_TOOL_ACTIONS = { ...CHROME_TOOL_ACTIONS };
|
|
234
|
+
|
|
235
|
+
export {
|
|
236
|
+
NOLO_CHROME_CONNECTOR_EXTENSION_ID,
|
|
237
|
+
NOLO_CHROME_CONNECTOR_PROTOCOL_VERSION,
|
|
238
|
+
createChromeConnectorClient,
|
|
239
|
+
REQUIRED_CHROME_CONNECTOR_FEATURES,
|
|
240
|
+
createVerifiedChromeConnectorClient,
|
|
241
|
+
executeChromeConnectorTool
|
|
242
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-NU6FRRNU.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-D42DMWKD.js";
|
|
8
8
|
import {
|
|
9
9
|
runLocalAgentTurn
|
|
10
10
|
} from "./chunk-CJ23A7U4.js";
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
readPipeText,
|
|
22
22
|
spawnProcess
|
|
23
|
-
} from "./chunk-
|
|
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],
|
|
@@ -147,7 +148,18 @@ async function runGit(args, cwd, options = {}) {
|
|
|
147
148
|
// 不消费 stderr 会让 git 阻塞在写满的 stderr 管道上永不退出(bun:child_process),
|
|
148
149
|
// proc.exited 随之永不 resolve——connector 收尾整体挂死(2026-09-16 实测)。
|
|
149
150
|
readPipeText(proc.stderr),
|
|
150
|
-
|
|
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
|
+
})
|
|
151
163
|
]);
|
|
152
164
|
if (exitCode !== 0) return null;
|
|
153
165
|
return options.trim === false ? stdout.replace(/\r?\n$/, "") : stdout.trim();
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addContentToSpace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DDWYTB5N.js";
|
|
4
4
|
import {
|
|
5
5
|
prepareAndPersistMessage,
|
|
6
6
|
uiAskChoiceFunc,
|
|
7
7
|
uiAskChoiceFunctionSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-PEBKIEA5.js";
|
|
9
9
|
import {
|
|
10
10
|
require_date_fns
|
|
11
11
|
} from "./chunk-M76ECQRD.js";
|
|
@@ -24,7 +24,9 @@ function spawnProcess(options) {
|
|
|
24
24
|
exited: Promise.resolve(127),
|
|
25
25
|
stdin: null,
|
|
26
26
|
stdout: null,
|
|
27
|
-
stderr: null
|
|
27
|
+
stderr: null,
|
|
28
|
+
kill: () => {
|
|
29
|
+
}
|
|
28
30
|
};
|
|
29
31
|
}
|
|
30
32
|
const exited = new Promise((resolve) => {
|
|
@@ -35,7 +37,13 @@ function spawnProcess(options) {
|
|
|
35
37
|
exited,
|
|
36
38
|
stdin: child.stdin,
|
|
37
39
|
stdout: child.stdout,
|
|
38
|
-
stderr: child.stderr
|
|
40
|
+
stderr: child.stderr,
|
|
41
|
+
kill: () => {
|
|
42
|
+
try {
|
|
43
|
+
child.kill("SIGKILL");
|
|
44
|
+
} catch {
|
|
45
|
+
}
|
|
46
|
+
}
|
|
39
47
|
};
|
|
40
48
|
}
|
|
41
49
|
async function readPipeText(stream) {
|
|
@@ -5,14 +5,14 @@ import {
|
|
|
5
5
|
inlineImageUrlsForCustomProvider,
|
|
6
6
|
prepareTools,
|
|
7
7
|
shouldInlineImageUrlsForAgent
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-KG7ANYLN.js";
|
|
9
9
|
import {
|
|
10
10
|
INVALID_TOOL_ARGS_REPLACEMENT,
|
|
11
11
|
buildInvalidToolCallSelfHealResult,
|
|
12
12
|
parseToolCallArguments,
|
|
13
13
|
performFetchRequest,
|
|
14
14
|
sanitizeOutboundMessages
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-ZNZCVXRV.js";
|
|
16
16
|
import {
|
|
17
17
|
createSSEParser,
|
|
18
18
|
createToolRunId,
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
toolRunSetPending,
|
|
24
24
|
toolRunStarted,
|
|
25
25
|
toolRunSucceeded
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-D42DMWKD.js";
|
|
27
27
|
import {
|
|
28
28
|
getPublicImageAgentMode
|
|
29
29
|
} from "./chunk-VIDPVFP3.js";
|
|
@@ -35,10 +35,10 @@ import {
|
|
|
35
35
|
messageStreamEnd,
|
|
36
36
|
messageStreaming,
|
|
37
37
|
updateToolMessage
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-PEBKIEA5.js";
|
|
39
39
|
import {
|
|
40
40
|
streamAgentChatTurn
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-6RUYWJXO.js";
|
|
42
42
|
import {
|
|
43
43
|
addActiveController,
|
|
44
44
|
removeActiveController,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
clipMultilineText,
|
|
9
9
|
fetchAndSerializeTable,
|
|
10
10
|
resolveBuiltinSkillPage
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-D42DMWKD.js";
|
|
12
12
|
import {
|
|
13
13
|
isGatewayHttpStatus
|
|
14
14
|
} from "./chunk-NF64D32W.js";
|
|
@@ -29,13 +29,13 @@ import {
|
|
|
29
29
|
} from "./chunk-MEYIRKDN.js";
|
|
30
30
|
import {
|
|
31
31
|
fetchAndCacheMessages
|
|
32
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-PEBKIEA5.js";
|
|
33
33
|
import {
|
|
34
34
|
shouldUseServerProxy
|
|
35
35
|
} from "./chunk-YYLHWIW6.js";
|
|
36
36
|
import {
|
|
37
37
|
fetchServerSyncedCredential
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-6RUYWJXO.js";
|
|
39
39
|
import {
|
|
40
40
|
buildSkillGuidancePromptBlock,
|
|
41
41
|
extractRuntimePageCapabilities,
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
updateContentPinned,
|
|
8
8
|
updateContentTitle,
|
|
9
9
|
uploadAndAddFileToSpace
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-DDWYTB5N.js";
|
|
11
11
|
import "./chunk-ZJ7UHBJS.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-PEBKIEA5.js";
|
|
13
13
|
import "./chunk-EVBFYPDC.js";
|
|
14
14
|
import "./chunk-HQUORJTM.js";
|
|
15
15
|
import "./chunk-YYLHWIW6.js";
|
|
16
16
|
import "./chunk-AGGIDPCZ.js";
|
|
17
|
-
import "./chunk-
|
|
17
|
+
import "./chunk-6RUYWJXO.js";
|
|
18
18
|
import "./chunk-BJCWNHVU.js";
|
|
19
19
|
import "./chunk-5RGU3J7P.js";
|
|
20
20
|
import "./chunk-6YTOJY35.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
addContentToSpace
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-DDWYTB5N.js";
|
|
4
4
|
import "./chunk-ZJ7UHBJS.js";
|
|
5
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-PEBKIEA5.js";
|
|
6
6
|
import "./chunk-EVBFYPDC.js";
|
|
7
7
|
import "./chunk-HQUORJTM.js";
|
|
8
8
|
import "./chunk-YYLHWIW6.js";
|
|
9
9
|
import "./chunk-AGGIDPCZ.js";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-6RUYWJXO.js";
|
|
11
11
|
import "./chunk-BJCWNHVU.js";
|
|
12
12
|
import "./chunk-5RGU3J7P.js";
|
|
13
13
|
import "./chunk-6YTOJY35.js";
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createDialogAction,
|
|
3
3
|
isLocalOwnerDialogAgents
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-WD4SMAPR.js";
|
|
5
|
+
import "./chunk-DDWYTB5N.js";
|
|
6
6
|
import "./chunk-ZJ7UHBJS.js";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-PEBKIEA5.js";
|
|
8
8
|
import "./chunk-EVBFYPDC.js";
|
|
9
9
|
import "./chunk-HQUORJTM.js";
|
|
10
10
|
import "./chunk-YYLHWIW6.js";
|
|
11
11
|
import "./chunk-AGGIDPCZ.js";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-6RUYWJXO.js";
|
|
13
13
|
import "./chunk-BJCWNHVU.js";
|
|
14
14
|
import "./chunk-5RGU3J7P.js";
|
|
15
15
|
import "./chunk-6YTOJY35.js";
|
|
@@ -14,16 +14,16 @@ import {
|
|
|
14
14
|
import {
|
|
15
15
|
addContentToSpace,
|
|
16
16
|
client_default
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-DDWYTB5N.js";
|
|
18
18
|
import {
|
|
19
19
|
getCurrentSpaceId
|
|
20
20
|
} from "./chunk-ZJ7UHBJS.js";
|
|
21
|
-
import "./chunk-
|
|
21
|
+
import "./chunk-PEBKIEA5.js";
|
|
22
22
|
import "./chunk-EVBFYPDC.js";
|
|
23
23
|
import "./chunk-HQUORJTM.js";
|
|
24
24
|
import "./chunk-YYLHWIW6.js";
|
|
25
25
|
import "./chunk-AGGIDPCZ.js";
|
|
26
|
-
import "./chunk-
|
|
26
|
+
import "./chunk-6RUYWJXO.js";
|
|
27
27
|
import "./chunk-BJCWNHVU.js";
|
|
28
28
|
import "./chunk-5RGU3J7P.js";
|
|
29
29
|
import "./chunk-6YTOJY35.js";
|