nolo-cli 0.1.19 → 0.1.21
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/README.md +9 -1
- package/agent-runtime/agentConfigOptions.ts +12 -0
- package/agent-runtime/agentRecordConfig.ts +99 -0
- package/agent-runtime/agentRecordKeys.ts +14 -0
- package/agent-runtime/dialogMessageRecord.ts +16 -0
- package/agent-runtime/dialogWritePlan.ts +130 -0
- package/agent-runtime/hostAdapter.ts +13 -0
- package/agent-runtime/hybridRecordStore.ts +147 -0
- package/agent-runtime/index.ts +69 -0
- package/agent-runtime/localLoop.ts +69 -5
- package/agent-runtime/localToolPolicy.ts +130 -0
- package/agent-runtime/localWorkspaceTools.ts +1532 -0
- package/agent-runtime/openAiCompatibleProvider.ts +70 -0
- package/agent-runtime/openAiCompatibleProviderConfig.ts +38 -0
- package/agent-runtime/platformChatProvider.ts +241 -0
- package/agent-runtime/taskWorkspace.ts +193 -0
- package/agent-runtime/types.ts +1 -0
- package/agent-runtime/workspaceSession.ts +76 -0
- package/agentAliases.ts +37 -0
- package/agentPullCommand.ts +1 -1
- package/agentRunCommand.ts +278 -52
- package/agentRuntimeCommands.ts +354 -164
- package/agentRuntimeLocal.ts +38 -0
- package/ai/agent/agentSlice.ts +10 -0
- package/ai/agent/buildEditingContext.ts +5 -0
- package/ai/agent/buildSystemPrompt.ts +41 -18
- package/ai/agent/canvasEditingContext.ts +49 -0
- package/ai/agent/cliExecutor.ts +15 -4
- package/ai/agent/createAgentSchema.ts +2 -0
- package/ai/agent/executeToolCall.ts +3 -2
- package/ai/agent/hooks/usePublicAgents.ts +6 -0
- package/ai/agent/pageBuilderHandoffRules.ts +75 -0
- package/ai/agent/runAgentClientLoop.ts +4 -1
- package/ai/agent/runtimeGuidance.ts +19 -0
- package/ai/agent/server/fetchPublicAgents.ts +51 -1
- package/ai/agent/streamAgentChatTurn.ts +20 -2
- package/ai/agent/streamAgentChatTurnUtils.ts +60 -16
- package/ai/chat/accumulateToolCallChunks.ts +40 -9
- package/ai/chat/parseApiError.ts +3 -0
- package/ai/chat/sendOpenAICompletionsRequest.native.ts +23 -10
- package/ai/chat/sendOpenAICompletionsRequest.ts +13 -1
- package/ai/chat/updateTotalUsage.ts +26 -9
- package/ai/llm/deepinfra.ts +51 -0
- package/ai/llm/getPricing.ts +6 -0
- package/ai/llm/kimi.ts +2 -0
- package/ai/llm/openrouterModels.ts +0 -135
- package/ai/llm/providers.ts +1 -0
- package/ai/llm/types.ts +8 -0
- package/ai/taskRun/taskRunProtocol.ts +882 -0
- package/ai/token/calculatePrice.ts +30 -0
- package/ai/token/externalToolCost.ts +49 -29
- package/ai/token/prepareTokenUsageData.ts +6 -1
- package/ai/token/serverTokenWriter.ts +4 -2
- package/ai/tools/agent/agentTools.ts +21 -0
- package/ai/tools/agent/presets/appBuilderPreset.ts +7 -0
- package/ai/tools/agent/streamParallelAgentsTool.ts +2 -1
- package/ai/tools/agent/taskRunTool.ts +112 -0
- package/ai/tools/applyEditTool.ts +6 -3
- package/ai/tools/applyLineEditsTool.ts +6 -3
- package/ai/tools/checkEnvTool.ts +14 -9
- package/ai/tools/codeSearchTool.ts +17 -5
- package/ai/tools/execBashTool.ts +33 -29
- package/ai/tools/fetchWebpageSupport.ts +24 -0
- package/ai/tools/fetchWebpageTool.ts +18 -5
- package/ai/tools/index.ts +158 -0
- package/ai/tools/jdProductScraperTool.ts +821 -0
- package/ai/tools/listFilesTool.ts +6 -3
- package/ai/tools/localFilesTool.ts +200 -0
- package/ai/tools/readFileTool.ts +6 -3
- package/ai/tools/searchRepoTool.ts +6 -3
- package/ai/tools/table/rowTools.ts +6 -1
- package/ai/tools/taobaoTmallProductScraperTool.ts +49 -0
- package/ai/tools/toolApiClient.ts +20 -6
- package/ai/tools/wereadGatewayTool.ts +152 -0
- package/ai/tools/writeFileTool.ts +6 -3
- package/client/agentConfigResolver.test.ts +70 -0
- package/client/agentConfigResolver.ts +1 -0
- package/client/agentRun.test.ts +430 -7
- package/client/agentRun.ts +504 -64
- package/client/hybridRecordStore.test.ts +115 -0
- package/client/hybridRecordStore.ts +41 -0
- package/client/localAgentRecords.test.ts +27 -0
- package/client/localAgentRecords.ts +7 -0
- package/client/localDialogRecords.test.ts +124 -0
- package/client/localDialogRecords.ts +30 -0
- package/client/localProviderResolver.test.ts +78 -0
- package/client/localProviderResolver.ts +1 -0
- package/client/localRuntimeAdapter.test.ts +621 -9
- package/client/localRuntimeAdapter.ts +275 -250
- package/client/localRuntimeDryRun.test.ts +116 -0
- package/client/localToolPolicy.ts +8 -81
- package/client/taskRunPrompt.ts +26 -0
- package/client/taskWorktree.ts +8 -0
- package/client/workspaceSession.test.ts +57 -0
- package/client/workspaceSession.ts +11 -0
- package/commandRegistry.ts +23 -6
- package/connectorRunArtifact.ts +121 -0
- package/database/actions/write.ts +16 -2
- package/database/hooks/useUserData.ts +9 -3
- package/database/server/dataHandlers.ts +18 -20
- package/database/server/emailRepository.ts +3 -3
- package/database/server/patch.ts +18 -10
- package/database/server/query.ts +43 -4
- package/database/server/read.ts +24 -38
- package/database/server/recordIdentity.ts +100 -0
- package/database/server/write.ts +21 -25
- package/index.ts +70 -33
- package/machineCommands.ts +318 -144
- package/package.json +4 -1
- package/tableCommands.ts +181 -0
- package/taskRunCommand.ts +265 -0
|
@@ -6,6 +6,7 @@ import {
|
|
|
6
6
|
assertFetchableDocsUrl,
|
|
7
7
|
detectExtractionIssue,
|
|
8
8
|
discoverCanonicalDocsUrl,
|
|
9
|
+
extractAdvertisedMarkdownUrl,
|
|
9
10
|
} from "./fetchWebpageSupport";
|
|
10
11
|
|
|
11
12
|
/**
|
|
@@ -57,28 +58,40 @@ export async function fetchWebpageFunc(
|
|
|
57
58
|
|
|
58
59
|
await assertFetchableDocsUrl(targetUrl, fetch, url);
|
|
59
60
|
|
|
60
|
-
|
|
61
|
+
let data = await callToolApi<{
|
|
61
62
|
markdown: string;
|
|
62
63
|
success: boolean;
|
|
63
64
|
browserMsUsed?: number;
|
|
64
65
|
source: string;
|
|
65
66
|
}>(thunkApi, "/api/cf-markdown", { url: targetUrl, gotoOptions }, { withAuth: true });
|
|
66
67
|
|
|
68
|
+
let finalUrl = targetUrl;
|
|
69
|
+
const advertisedMarkdownUrl = extractAdvertisedMarkdownUrl(data.markdown ?? "", targetUrl);
|
|
70
|
+
if (advertisedMarkdownUrl && advertisedMarkdownUrl !== targetUrl) {
|
|
71
|
+
finalUrl = advertisedMarkdownUrl;
|
|
72
|
+
data = await callToolApi<{
|
|
73
|
+
markdown: string;
|
|
74
|
+
success: boolean;
|
|
75
|
+
browserMsUsed?: number;
|
|
76
|
+
source: string;
|
|
77
|
+
}>(thunkApi, "/api/cf-markdown", { url: finalUrl, gotoOptions }, { withAuth: true });
|
|
78
|
+
}
|
|
79
|
+
|
|
67
80
|
const markdown = data.markdown ?? "";
|
|
68
|
-
const extractionIssue = detectExtractionIssue(markdown,
|
|
81
|
+
const extractionIssue = detectExtractionIssue(markdown, finalUrl);
|
|
69
82
|
if (extractionIssue) {
|
|
70
83
|
throw new Error(extractionIssue.message);
|
|
71
84
|
}
|
|
72
85
|
|
|
73
86
|
const seconds = data.browserMsUsed ? (data.browserMsUsed / 1000).toFixed(2) : "?";
|
|
74
87
|
const statusMsg =
|
|
75
|
-
`✅ 已成功获取网页内容 (URL: ${
|
|
88
|
+
`✅ 已成功获取网页内容 (URL: ${finalUrl})\n` +
|
|
76
89
|
`🌐 渲染引擎: Cloudflare Browser Rendering\n` +
|
|
77
90
|
`⏱ 浏览器耗时: ${seconds}s | 字符数: ${markdown.length}` +
|
|
78
|
-
(
|
|
91
|
+
(finalUrl !== url ? `\n🧭 文档地址已规范化: ${url} → ${finalUrl}` : "");
|
|
79
92
|
|
|
80
93
|
return {
|
|
81
|
-
rawData:
|
|
94
|
+
rawData: finalUrl === url ? markdown : `[Resolved URL] ${finalUrl}\n\n${markdown}`,
|
|
82
95
|
displayData: `${statusMsg}\n\n${markdown}`,
|
|
83
96
|
};
|
|
84
97
|
}
|
package/ai/tools/index.ts
CHANGED
|
@@ -84,6 +84,19 @@ import {
|
|
|
84
84
|
deleteSpacesFunc,
|
|
85
85
|
deleteSpacesPreviewFunc,
|
|
86
86
|
} from "./deleteSpacesTool";
|
|
87
|
+
import {
|
|
88
|
+
executeApprovedLocalFileChangesFunc,
|
|
89
|
+
executeApprovedLocalFileChangesFunctionSchema,
|
|
90
|
+
listLocalFilesFunc,
|
|
91
|
+
listLocalFilesFunctionSchema,
|
|
92
|
+
proposeLocalFileChangesFunc,
|
|
93
|
+
proposeLocalFileChangesFunctionSchema,
|
|
94
|
+
proposeLocalFileChangesPreviewFunc,
|
|
95
|
+
readLocalFileFunc,
|
|
96
|
+
readLocalFileFunctionSchema,
|
|
97
|
+
undoLocalFileChangeBatchFunc,
|
|
98
|
+
undoLocalFileChangeBatchFunctionSchema,
|
|
99
|
+
} from "./localFilesTool";
|
|
87
100
|
import {
|
|
88
101
|
emailArchiveFunc,
|
|
89
102
|
emailArchiveFunctionSchema,
|
|
@@ -155,6 +168,10 @@ import {
|
|
|
155
168
|
surfWeatherFunctionSchema,
|
|
156
169
|
surfWeatherFunc,
|
|
157
170
|
} from "./surfWeatherTool";
|
|
171
|
+
import {
|
|
172
|
+
wereadGatewayFunctionSchema,
|
|
173
|
+
wereadGatewayFunc,
|
|
174
|
+
} from "./wereadGatewayTool";
|
|
158
175
|
|
|
159
176
|
import {
|
|
160
177
|
browser_closeSession_Schema,
|
|
@@ -231,6 +248,14 @@ import {
|
|
|
231
248
|
amazonProductScraperFunctionSchema,
|
|
232
249
|
amazonProductScraperFunc,
|
|
233
250
|
} from "./amazonProductScraperTool";
|
|
251
|
+
import {
|
|
252
|
+
taobaoTmallProductScraperFunctionSchema,
|
|
253
|
+
taobaoTmallProductScraperFunc,
|
|
254
|
+
} from "./taobaoTmallProductScraperTool";
|
|
255
|
+
import {
|
|
256
|
+
jdProductScraperFunctionSchema,
|
|
257
|
+
jdProductScraperFunc,
|
|
258
|
+
} from "./jdProductScraperTool";
|
|
234
259
|
|
|
235
260
|
// ✅ 多模态:Gemini 图片(2.5 Flash 文生图 / 3 Pro 编辑)
|
|
236
261
|
import {
|
|
@@ -823,6 +848,21 @@ const baseToolDefinitions: ToolDefinition[] = [
|
|
|
823
848
|
costLevel: "medium",
|
|
824
849
|
defaultConsent: "ask",
|
|
825
850
|
},
|
|
851
|
+
{
|
|
852
|
+
id: "wereadGateway",
|
|
853
|
+
schema: wereadGatewayFunctionSchema,
|
|
854
|
+
executor: wereadGatewayFunc,
|
|
855
|
+
description: {
|
|
856
|
+
name: "wereadGateway",
|
|
857
|
+
description: "调用微信读书接口,支持书架、搜索、阅读统计、笔记划线、书评和推荐。",
|
|
858
|
+
category: "网络",
|
|
859
|
+
},
|
|
860
|
+
behavior: "data",
|
|
861
|
+
uiGroup: "external",
|
|
862
|
+
capability: "web_search",
|
|
863
|
+
riskLevel: "low",
|
|
864
|
+
costLevel: "low",
|
|
865
|
+
},
|
|
826
866
|
{
|
|
827
867
|
id: "readDoc",
|
|
828
868
|
schema: readDocFunctionSchema,
|
|
@@ -1327,6 +1367,90 @@ const baseToolDefinitions: ToolDefinition[] = [
|
|
|
1327
1367
|
costLevel: "low",
|
|
1328
1368
|
defaultConsent: "ask",
|
|
1329
1369
|
},
|
|
1370
|
+
{
|
|
1371
|
+
id: "listLocalFiles",
|
|
1372
|
+
schema: listLocalFilesFunctionSchema,
|
|
1373
|
+
executor: listLocalFilesFunc,
|
|
1374
|
+
description: {
|
|
1375
|
+
name: "listLocalFiles",
|
|
1376
|
+
description: "列出 Windows 桌面客户端中用户已授权本地文件夹内的文件和目录。",
|
|
1377
|
+
category: "本地文件",
|
|
1378
|
+
},
|
|
1379
|
+
behavior: "data",
|
|
1380
|
+
uiGroup: "data",
|
|
1381
|
+
capability: "general",
|
|
1382
|
+
riskLevel: "low",
|
|
1383
|
+
costLevel: "low",
|
|
1384
|
+
defaultConsent: "ask",
|
|
1385
|
+
},
|
|
1386
|
+
{
|
|
1387
|
+
id: "readLocalFile",
|
|
1388
|
+
schema: readLocalFileFunctionSchema,
|
|
1389
|
+
executor: readLocalFileFunc,
|
|
1390
|
+
description: {
|
|
1391
|
+
name: "readLocalFile",
|
|
1392
|
+
description: "读取 Windows 桌面客户端中用户已授权本地文件夹内的文本文件。",
|
|
1393
|
+
category: "本地文件",
|
|
1394
|
+
},
|
|
1395
|
+
behavior: "data",
|
|
1396
|
+
uiGroup: "data",
|
|
1397
|
+
capability: "general",
|
|
1398
|
+
riskLevel: "medium",
|
|
1399
|
+
costLevel: "low",
|
|
1400
|
+
defaultConsent: "ask",
|
|
1401
|
+
},
|
|
1402
|
+
{
|
|
1403
|
+
id: "proposeLocalFileChanges",
|
|
1404
|
+
schema: proposeLocalFileChangesFunctionSchema,
|
|
1405
|
+
executor: proposeLocalFileChangesFunc,
|
|
1406
|
+
previewExecutor: proposeLocalFileChangesPreviewFunc,
|
|
1407
|
+
description: {
|
|
1408
|
+
name: "proposeLocalFileChanges",
|
|
1409
|
+
description: "为用户已授权的本地文件夹创建待确认整理计划,不会直接修改本地文件。",
|
|
1410
|
+
category: "本地文件",
|
|
1411
|
+
},
|
|
1412
|
+
behavior: "action",
|
|
1413
|
+
uiGroup: "data",
|
|
1414
|
+
capability: "general",
|
|
1415
|
+
interaction: "confirm",
|
|
1416
|
+
riskLevel: "high",
|
|
1417
|
+
costLevel: "low",
|
|
1418
|
+
defaultConsent: "ask",
|
|
1419
|
+
},
|
|
1420
|
+
{
|
|
1421
|
+
id: "executeApprovedLocalFileChanges",
|
|
1422
|
+
schema: executeApprovedLocalFileChangesFunctionSchema,
|
|
1423
|
+
executor: executeApprovedLocalFileChangesFunc,
|
|
1424
|
+
description: {
|
|
1425
|
+
name: "executeApprovedLocalFileChanges",
|
|
1426
|
+
description: "执行用户已经确认的本地文件整理计划。",
|
|
1427
|
+
category: "本地文件",
|
|
1428
|
+
},
|
|
1429
|
+
behavior: "action",
|
|
1430
|
+
uiGroup: "data",
|
|
1431
|
+
capability: "general",
|
|
1432
|
+
interaction: "confirm",
|
|
1433
|
+
riskLevel: "high",
|
|
1434
|
+
costLevel: "low",
|
|
1435
|
+
defaultConsent: "ask",
|
|
1436
|
+
},
|
|
1437
|
+
{
|
|
1438
|
+
id: "undoLocalFileChangeBatch",
|
|
1439
|
+
schema: undoLocalFileChangeBatchFunctionSchema,
|
|
1440
|
+
executor: undoLocalFileChangeBatchFunc,
|
|
1441
|
+
description: {
|
|
1442
|
+
name: "undoLocalFileChangeBatch",
|
|
1443
|
+
description: "撤销一个本地文件整理批次中可撤销的移动或重命名操作。",
|
|
1444
|
+
category: "本地文件",
|
|
1445
|
+
},
|
|
1446
|
+
behavior: "action",
|
|
1447
|
+
uiGroup: "data",
|
|
1448
|
+
capability: "general",
|
|
1449
|
+
interaction: "confirm",
|
|
1450
|
+
riskLevel: "medium",
|
|
1451
|
+
costLevel: "low",
|
|
1452
|
+
defaultConsent: "ask",
|
|
1453
|
+
},
|
|
1330
1454
|
|
|
1331
1455
|
// --- 网络与智能 ---
|
|
1332
1456
|
{
|
|
@@ -1432,6 +1556,40 @@ const baseToolDefinitions: ToolDefinition[] = [
|
|
|
1432
1556
|
},
|
|
1433
1557
|
behavior: "data",
|
|
1434
1558
|
},
|
|
1559
|
+
{
|
|
1560
|
+
id: "taobaoTmallProductScraper",
|
|
1561
|
+
schema: taobaoTmallProductScraperFunctionSchema,
|
|
1562
|
+
executor: taobaoTmallProductScraperFunc,
|
|
1563
|
+
description: {
|
|
1564
|
+
name: "taobaoTmallProductScraper",
|
|
1565
|
+
description:
|
|
1566
|
+
"使用 Apify Taobao/Tmall Product Scraper 抓取淘宝/天猫商品真实详情、SKU、价格、库存和规格参数。",
|
|
1567
|
+
category: "网络与智能",
|
|
1568
|
+
},
|
|
1569
|
+
behavior: "data",
|
|
1570
|
+
capability: "web_access",
|
|
1571
|
+
riskLevel: "low",
|
|
1572
|
+
costLevel: "low",
|
|
1573
|
+
defaultConsent: "auto",
|
|
1574
|
+
cancelable: true,
|
|
1575
|
+
},
|
|
1576
|
+
{
|
|
1577
|
+
id: "jdProductScraper",
|
|
1578
|
+
schema: jdProductScraperFunctionSchema,
|
|
1579
|
+
executor: jdProductScraperFunc,
|
|
1580
|
+
description: {
|
|
1581
|
+
name: "jdProductScraper",
|
|
1582
|
+
description:
|
|
1583
|
+
"抓取京东商品页内嵌真实商品参数,返回标题、品牌、型号、店铺、尺寸重量、价格、图片、变体和库存状态。",
|
|
1584
|
+
category: "网络与智能",
|
|
1585
|
+
},
|
|
1586
|
+
behavior: "data",
|
|
1587
|
+
capability: "web_access",
|
|
1588
|
+
riskLevel: "low",
|
|
1589
|
+
costLevel: "low",
|
|
1590
|
+
defaultConsent: "auto",
|
|
1591
|
+
cancelable: true,
|
|
1592
|
+
},
|
|
1435
1593
|
{
|
|
1436
1594
|
id: "amazonProductScraper",
|
|
1437
1595
|
schema: amazonProductScraperFunctionSchema,
|