nolo-cli 0.19.0 → 0.24.0-alpha.13
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 -18
- package/{_executeModel-X5PCIZN6.js → _executeModel-ZPNYAEFW.js} +46 -44
- package/{action-LT7BRFLK.js → action-5MNAXR5B.js} +7 -6
- package/{addContentAction-PL3KKBDH.js → addContentAction-UNSYTVTB.js} +5 -5
- package/{addDialogAgentAction-FCMSKYAF.js → addDialogAgentAction-LJGNP2AO.js} +5 -5
- package/{agentDeleteCommand-2BZDQV36.js → agentDeleteCommand-5ZV4433K.js} +27 -26
- package/{agentEmailCommands-2QJDGRMB.js → agentEmailCommands-Z7KOYDVQ.js} +57 -55
- package/{agentListCommands-6VEPTKBI.js → agentListCommands-UQUXJYUN.js} +30 -26
- package/{agentMachineCommands-NVVHNWYI.js → agentMachineCommands-53O6P6L5.js} +25 -24
- package/{agentRecordCommands-4GGRDMD4.js → agentRecordCommands-ZRYNBSSS.js} +52 -50
- package/{agentRunCommand-XOLQNKBZ.js → agentRunCommand-B73MKVOG.js} +55 -54
- package/{agentRunControl-Y5AFH5PQ.js → agentRunControl-SNUKXN6J.js} +6 -2
- package/{agentRuntimeLocal-7WYWCGL4.js → agentRuntimeLocal-GVNERRKQ.js} +21 -18
- package/{agentSlice-EAXPGEYV.js → agentSlice-OJBHIL34.js} +5 -5
- package/{appDeleteCommands-77KR2RJ4.js → appDeleteCommands-23Z3Z6KE.js} +23 -22
- package/{appDeployCommands-K7CAHGBI.js → appDeployCommands-3MFAR4Z7.js} +23 -22
- package/{appDeployStatusCommands-4OEKLTBT.js → appDeployStatusCommands-JHU6GSN4.js} +23 -22
- package/{appGetCommands-VM2WDLAZ.js → appGetCommands-24J55H2Y.js} +23 -22
- package/{appListCommands-GX6BBA6U.js → appListCommands-HE5KP3PH.js} +23 -22
- package/{authCommand-DY6UUL6O.js → authCommand-KGRK6MNU.js} +12 -13
- package/{authCommands-XTBV7OFZ.js → authCommands-JSOG2H4E.js} +4 -5
- package/{chunk-OWOHNGCN.js → chunk-2MBTWINN.js} +42 -3
- package/{chunk-MVQ4TBSD.js → chunk-54VHTARN.js} +1 -1
- package/{chunk-RQN4SEKL.js → chunk-5DWZ46RJ.js} +1 -1
- package/{chunk-VYHDJEQD.js → chunk-5EDKWSQN.js} +136 -78
- package/{chunk-Z4NR32XR.js → chunk-5RGU3J7P.js} +13 -0
- package/{chunk-7BUYEZ6U.js → chunk-7H3UTGPM.js} +12 -72
- package/{chunk-3ZX7PERL.js → chunk-AAWJ5S3G.js} +20 -7
- package/{chunk-SCTYAHYK.js → chunk-ADE6577S.js} +237 -142
- package/{chunk-PJSV3IZ5.js → chunk-AOPOTHFK.js} +1 -1
- package/{chunk-3ND52WIL.js → chunk-ATWUOTJP.js} +180 -24
- package/{chunk-SWDPIPOY.js → chunk-AZW5AHMW.js} +1 -1
- package/chunk-CF7S2RYZ.js +376 -0
- package/{chunk-L4F3I4SR.js → chunk-CV6BM7LU.js} +4 -6
- package/{chunk-G5U6LDLG.js → chunk-CWTT2NZ6.js} +6 -6
- package/{chunk-MKA6QE5E.js → chunk-CZHE6LLV.js} +135 -55
- package/{chunk-KFEVY3ST.js → chunk-D34RI6NI.js} +18 -8
- package/{chunk-XRZJGPFI.js → chunk-FON47ACC.js} +4 -4
- package/{chunk-K6EUAOW3.js → chunk-FXFGNOT2.js} +67 -1
- package/{chunk-LLWKHDG4.js → chunk-G36SUBHA.js} +14 -6
- package/{chunk-REA4JLBH.js → chunk-GD23ZX7Z.js} +7 -6
- package/{chunk-ROWQEJRP.js → chunk-GE6IWA5N.js} +12 -4
- package/{chunk-EDV7EBOI.js → chunk-GGB6MPHD.js} +2155 -1503
- package/{chunk-IYEXFJPC.js → chunk-GNGOZMU2.js} +64 -57
- package/{chunk-4T5F7YZQ.js → chunk-I6RJGORZ.js} +1 -1
- package/{chunk-DFCFMCY6.js → chunk-J2WT5CEO.js} +2 -2
- package/{chunk-AHCY2S2I.js → chunk-JJ2WUBFN.js} +1 -1
- package/{chunk-UGUW3FHG.js → chunk-JMSCXQUG.js} +2 -2
- package/{chunk-VDXCXCXH.js → chunk-KURQBS7S.js} +1 -1
- package/{chunk-FQZZLA3C.js → chunk-KXKQO4Q6.js} +17 -0
- package/{chunk-3Q7WHGCB.js → chunk-L65QKSVJ.js} +1 -1
- package/{chunk-UAIVG4J6.js → chunk-LEHTC2FI.js} +1 -8
- package/{chunk-UBHAWFQ6.js → chunk-LLDGWLML.js} +42 -19
- package/{chunk-JLA4FXYC.js → chunk-MALVZUYL.js} +1 -1
- package/{chunk-N54HIJVJ.js → chunk-MCXQNEJ3.js} +101 -9
- package/{chunk-GFUIQ4RY.js → chunk-MXFQHRSS.js} +1 -1
- package/{chunk-LSFAWXKC.js → chunk-N7J63Q6C.js} +1 -0
- package/{chunk-6Y7A3OQQ.js → chunk-NRY4GCKJ.js} +2 -0
- package/{chunk-ELT65PZW.js → chunk-OXLLFZNF.js} +1 -1
- package/{chunk-YGW4G5W5.js → chunk-P3RZ6DHN.js} +133 -25
- package/{chunk-5MIDPSSK.js → chunk-PB7G5MAM.js} +3 -3
- package/{chunk-HEGV7BH3.js → chunk-PMCKFQYC.js} +1 -1
- package/{chunk-23FZYPLC.js → chunk-PTKI7TIN.js} +911 -1064
- package/{chunk-MHSGJW4Z.js → chunk-PXPISYEH.js} +44 -14
- package/{chunk-I2ZJKTG5.js → chunk-PY7VGC5M.js} +29 -10
- package/{chunk-PIZYJVHQ.js → chunk-RM464B7I.js} +4 -4
- package/{chunk-XHG22OEX.js → chunk-ROJI6DRT.js} +2 -2
- package/{chunk-VNAEBGDK.js → chunk-RZNYL4LW.js} +123 -26
- package/{chunk-RVOUXDFU.js → chunk-S6KVFOUG.js} +6 -34
- package/{chunk-BV4VEE3W.js → chunk-S7AV3NCK.js} +277 -357
- package/{chunk-R35XMF6F.js → chunk-SIUEKVK4.js} +484 -67
- package/{chunk-B5TOXZAK.js → chunk-SIZQB7BD.js} +1 -1
- package/{chunk-DFFIZ25G.js → chunk-SLOGKB7M.js} +4 -1
- package/{chunk-MPVYDS7I.js → chunk-TLYHUIWF.js} +3 -3
- package/{chunk-HWW2M4SN.js → chunk-TNM27YZ7.js} +5 -4
- package/{chunk-OK6YSWLH.js → chunk-TWA4L7J7.js} +1 -1
- package/chunk-UZ6XXCVR.js +50 -0
- package/{chunk-DKZFOK24.js → chunk-WCP5FDTF.js} +16 -304
- package/{chunk-TRT4I4UD.js → chunk-WSQLK2KR.js} +2 -2
- package/{chunk-FXUSIQC2.js → chunk-XNZJVYFS.js} +1 -1
- package/{chunk-V3ED5AWK.js → chunk-YJY7HODU.js} +27 -16
- package/chunk-YYLHWIW6.js +48 -0
- package/{chunk-CZ6NYQTV.js → chunk-ZFL3LTU7.js} +2 -2
- package/{chunk-34WPV75U.js → chunk-ZUXIXYJI.js} +1 -1
- package/{chunk-VC6OZXO5.js → chunk-ZWJOGMKH.js} +2 -26
- package/{cliExecutor-DNE7TCC4.js → cliExecutor-K3F7DMRO.js} +2 -2
- package/{codingSkills-36KN5NQT.js → codingSkills-EN6Z6G6U.js} +4 -4
- package/{createAgentAutomationAction-GNFF524X.js → createAgentAutomationAction-PO62NUR7.js} +19 -18
- package/{createDialogAction-RB55KCLO.js → createDialogAction-ORFRYI3C.js} +22 -20
- package/{createPageAction-Y7343GLU.js → createPageAction-XWVMNTYH.js} +20 -19
- package/{db-W3O47YGF.js → db-W5UHK4P3.js} +150 -0
- package/{dbSlice-CGSRFJN3.js → dbSlice-5BKDURDL.js} +4 -4
- package/{dialogCommands-IAZK6YHQ.js → dialogCommands-XTJHROXM.js} +24 -23
- package/{dialogSlice-UQAXF23P.js → dialogSlice-DJXC53YW.js} +24 -18
- package/{docCreateCommands-I2EWZGCI.js → docCreateCommands-T2XRVXYS.js} +24 -27
- package/{docDeleteCommands-IZ45UZKG.js → docDeleteCommands-L7RXFXY3.js} +25 -24
- package/{docReadCommands-R6Z4QJYU.js → docReadCommands-M5PYNADQ.js} +24 -23
- package/{docStore-5HOJ4D7D.js → docStore-6LKLLFDW.js} +20 -19
- package/{docUpdateCommands-2LRBKQPY.js → docUpdateCommands-OA5EGPLQ.js} +24 -27
- package/{fetchMessages-BMGVZVSE.js → fetchMessages-W4IKHPCS.js} +2 -3
- package/{getPricing-G7DLAST6.js → getPricing-6C3C47Y4.js} +3 -3
- package/{handleSendMessageAction-Q4HY35WX.js → handleSendMessageAction-ILFGZTN5.js} +23 -20
- package/index.js +74 -74
- package/{localDialogRead-4H3QJFLW.js → localDialogRead-JXTAHW2E.js} +2 -2
- package/{machineCommands-PKBPQKTY.js → machineCommands-AKAQGPAO.js} +59 -57
- package/{machineWsRunDispatch-UZAW4OXJ.js → machineWsRunDispatch-RSBERM64.js} +51 -49
- package/{models-DJFSJ7SW.js → models-ILWKIX2Y.js} +2 -2
- package/package.json +1 -1
- package/{read-3FMPZPER.js → read-F3L3T2WJ.js} +2 -1
- package/{readDocTool-VSYHKK3V.js → readDocTool-FOHWVA4R.js} +1 -1
- package/{readlineWorkspace-Y2RDOFZG.js → readlineWorkspace-TUH3SFHO.js} +937 -430
- package/{removeDialogAgentAction-OAGA2G3U.js → removeDialogAgentAction-QCFGIUIH.js} +8 -7
- package/{runAgentClientLoop-NBPIKJ6J.js → runAgentClientLoop-C3QB2EXV.js} +45 -38
- package/{setDialogExtraReferencesAction-JZEXA5SL.js → setDialogExtraReferencesAction-DK4CKERU.js} +5 -5
- package/{setPrimaryDialogAgentAction-4ZUQQKDG.js → setPrimaryDialogAgentAction-SJSO6N27.js} +8 -7
- package/{settingSlice-7MNKHZ6R.js → settingSlice-XNM5AFPU.js} +6 -5
- package/{spaceCommands-DHCZ7J5I.js → spaceCommands-SXYOFGUJ.js} +25 -24
- package/{spaceSlice-ZXLLG3CR.js → spaceSlice-6BHMRP5O.js} +21 -18
- package/{streamAgentChatTurn-L3YW6LSB.js → streamAgentChatTurn-GF5W5OIP.js} +140 -98
- package/switchDialogAgentAction-4OAC6QRN.js +61 -0
- package/{tableCommands-BEQAGE4I.js → tableCommands-QSZILI7I.js} +1 -1
- package/{toolApiClient-QI3YBNWB.js → toolApiClient-ISM4ZQX4.js} +2 -2
- package/{tools-ECGXR5QF.js → tools-KBCLJ43G.js} +36 -33
- package/{tuiSummaryLlmCaller-OMSCNHXA.js → tuiSummaryLlmCaller-ARIMGILF.js} +6 -6
- package/{updateCommands-XTW55TOT.js → updateCommands-AK2RDOFR.js} +8 -2
- package/{updateDialogTitleAction-HQ2EUDFT.js → updateDialogTitleAction-LMHZUY4Q.js} +28 -27
- package/chunk-DL6EPNIK.js +0 -50
- package/chunk-V5R4NZP2.js +0 -78
- package/chunk-X4Q4UZEY.js +0 -26
- package/queryRunOverlay-O4LOMMPO.js +0 -161
- package/runOverlayPresentation-ZO4VCWEU.js +0 -11
- package/types-ZSTJ7MPR.js +0 -7
- package/{chunk-X7W4TNB4.js → chunk-CMKUBIGW.js} +3 -3
- package/{runtimeDoctorCommands-E2OUORHK.js → runtimeDoctorCommands-HSU632DY.js} +3 -3
|
@@ -23,8 +23,11 @@ var extractCustomId = (key) => {
|
|
|
23
23
|
}
|
|
24
24
|
return extractKeyPart(key, 2);
|
|
25
25
|
};
|
|
26
|
+
var PUBLIC_AGENT_KEY_PREFIX = "agent-pub-";
|
|
27
|
+
var publicAgentKey = (id) => `${PUBLIC_AGENT_KEY_PREFIX}${id}`;
|
|
26
28
|
|
|
27
29
|
export {
|
|
28
30
|
extractUserId,
|
|
29
|
-
extractCustomId
|
|
31
|
+
extractCustomId,
|
|
32
|
+
publicAgentKey
|
|
30
33
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PTKI7TIN.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-GGB6MPHD.js";
|
|
8
8
|
import {
|
|
9
9
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-P3RZ6DHN.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveLocalRuntimeEnvFromPolicy
|
|
13
13
|
} from "./chunk-5CS33IBL.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-PMCKFQYC.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-J2WT5CEO.js";
|
|
8
8
|
import {
|
|
9
9
|
toSafeAgentSummary
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-AAWJ5S3G.js";
|
|
11
11
|
|
|
12
12
|
// packages/cli/agentListHelpers.ts
|
|
13
13
|
function parseAgentRecordId(privateKey, explicitId) {
|
|
@@ -51,7 +51,8 @@ function normalizeListedAgent(record) {
|
|
|
51
51
|
credentialRef,
|
|
52
52
|
apiKeyRef,
|
|
53
53
|
...typeof record?.apiSource === "string" && record.apiSource ? { apiSource: record.apiSource } : {},
|
|
54
|
-
...typeof record?.cliProvider === "string" && record.cliProvider ? { cliProvider: record.cliProvider } : {}
|
|
54
|
+
...typeof record?.cliProvider === "string" && record.cliProvider ? { cliProvider: record.cliProvider } : {},
|
|
55
|
+
...typeof record?.nextAvailableAt === "number" && Number.isFinite(record.nextAvailableAt) ? { nextAvailableAt: record.nextAvailableAt } : {}
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
function toSafeListedAgentSummary(agent, options) {
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
// packages/ai/tools/agentCapabilities.ts
|
|
2
|
+
var SYSTEM_AGENT_CAPABILITIES = [
|
|
3
|
+
{
|
|
4
|
+
id: "web-search",
|
|
5
|
+
label: "\u8054\u7F51\u641C\u7D22",
|
|
6
|
+
description: "\u8BA9 agent \u80FD\u641C\u7D22\u4E92\u8054\u7F51\u3001\u6293\u53D6\u7F51\u9875\u5185\u5BB9\uFF0C\u83B7\u53D6\u6700\u65B0\u4FE1\u606F\u3002",
|
|
7
|
+
tools: ["exa_search", "fetchWebpage"],
|
|
8
|
+
defaultEnabled: true,
|
|
9
|
+
icon: "\u{1F310}"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
id: "web-scrape",
|
|
13
|
+
label: "\u6DF1\u5EA6\u7F51\u9875\u6293\u53D6",
|
|
14
|
+
description: "\u5728\u666E\u901A\u8054\u7F51\u641C\u7D22\u4E4B\u5916\uFF0C\u7528 Firecrawl \u505A\u7ED3\u6784\u5316\u641C\u7D22\u4E0E\u6574\u9875\u6293\u53D6\uFF0C\u9002\u5408\u9700\u8981\u5B8C\u6574\u6B63\u6587\u3001\u6587\u6863\u7AD9\u70B9\u6216\u7AD9\u5185\u68C0\u7D22\u7684\u573A\u666F\u3002",
|
|
15
|
+
tools: ["firecrawl_search", "firecrawl_scrape"],
|
|
16
|
+
defaultEnabled: true,
|
|
17
|
+
icon: "\u{1F578}\uFE0F"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
id: "conversation-todo",
|
|
21
|
+
label: "\u5BF9\u8BDD Todo",
|
|
22
|
+
description: "\u5728\u591A\u6B65\u9AA4\u5BF9\u8BDD\u4E2D\u663E\u793A\u548C\u66F4\u65B0\u4EFB\u52A1\u8FDB\u5EA6\u3002\u5173\u95ED\u540E\uFF0CAgent \u4E0D\u4F1A\u4F7F\u7528\u5BF9\u8BDD\u5185 Todo \u5DE5\u5177\u3002",
|
|
23
|
+
tools: ["setTodoList"],
|
|
24
|
+
defaultEnabled: true,
|
|
25
|
+
icon: "\u2611\uFE0F"
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
id: "agent-orchestration",
|
|
29
|
+
label: "\u591A agent \u7F16\u6392",
|
|
30
|
+
description: "\u5148\u6309\u6536\u85CF\u3001\u7B80\u4ECB\u3001\u80FD\u529B\u548C\u6210\u672C\u5217\u51FA\u5B89\u5168 agent \u6458\u8981\uFF0C\u6309\u9700\u8BFB\u53D6\u5019\u9009\u914D\u7F6E\u89E3\u6790\u53EF\u8FD0\u884C key\uFF0C\u518D\u540E\u53F0\u542F\u52A8\u5176\u4ED6 agent \u6267\u884C\u5B50\u4EFB\u52A1\uFF0C\u5E76\u89C2\u5BDF\u3001\u67E5\u8BE2\u3001\u505C\u6B62\u8FD0\u884C\u4E2D\u7684 agent run\u2014\u2014\u9002\u5408\u5E76\u884C\u6D3E\u53D1\u3001\u957F\u4EFB\u52A1\u8DDF\u8E2A\u3001\u4E2D\u9014\u53EB\u505C\u7B49\u7F16\u6392\u573A\u666F\u3002",
|
|
31
|
+
tools: ["startAgentRun", "controlAgentRun", "listAgents"],
|
|
32
|
+
defaultEnabled: true,
|
|
33
|
+
icon: "\u{1F9E9}"
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
var SYSTEM_AGENT_CAPABILITY_IDS = SYSTEM_AGENT_CAPABILITIES.map(
|
|
37
|
+
({ id }) => id
|
|
38
|
+
);
|
|
39
|
+
var DEFAULT_SYSTEM_AGENT_CAPABILITIES = Object.fromEntries(
|
|
40
|
+
SYSTEM_AGENT_CAPABILITIES.map(({ id, defaultEnabled }) => [
|
|
41
|
+
id,
|
|
42
|
+
defaultEnabled
|
|
43
|
+
])
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
export {
|
|
47
|
+
SYSTEM_AGENT_CAPABILITIES,
|
|
48
|
+
SYSTEM_AGENT_CAPABILITY_IDS,
|
|
49
|
+
DEFAULT_SYSTEM_AGENT_CAPABILITIES
|
|
50
|
+
};
|
|
@@ -127,180 +127,6 @@ function redactAgentRecordForWorkspaceTool(record) {
|
|
|
127
127
|
return redacted;
|
|
128
128
|
}
|
|
129
129
|
|
|
130
|
-
// packages/agent-runtime/runtimeCompat.ts
|
|
131
|
-
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
132
|
-
import { join } from "node:path";
|
|
133
|
-
import { spawn } from "node:child_process";
|
|
134
|
-
var IS_WINDOWS = process.platform === "win32";
|
|
135
|
-
function isExecutableFile(candidate) {
|
|
136
|
-
if (!existsSync(candidate)) return false;
|
|
137
|
-
try {
|
|
138
|
-
return statSync(candidate).isFile();
|
|
139
|
-
} catch {
|
|
140
|
-
return false;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
function resolveExecutableOnPath(name) {
|
|
144
|
-
if (IS_WINDOWS && !/\.[a-z]+$/i.test(name)) {
|
|
145
|
-
const exts = (process.env.PATHEXT || ".EXE;.CMD;.BAT").split(";").filter(Boolean);
|
|
146
|
-
for (const ext of exts) {
|
|
147
|
-
const found = resolveExecutableOnPath(name + ext);
|
|
148
|
-
if (found) return found;
|
|
149
|
-
}
|
|
150
|
-
return null;
|
|
151
|
-
}
|
|
152
|
-
const pathEnv = process.env.PATH ?? "";
|
|
153
|
-
const sep = pathEnv.includes(";") && IS_WINDOWS ? ";" : ":";
|
|
154
|
-
const pathDirs = pathEnv.split(sep).filter(Boolean);
|
|
155
|
-
const fallbackDirs = IS_WINDOWS ? [] : [
|
|
156
|
-
"/opt/homebrew/bin",
|
|
157
|
-
"/usr/local/bin",
|
|
158
|
-
"/usr/bin",
|
|
159
|
-
"/bin",
|
|
160
|
-
`${process.env.HOME ?? ""}/.local/bin`
|
|
161
|
-
].filter(Boolean);
|
|
162
|
-
for (const dir of [...pathDirs, ...fallbackDirs]) {
|
|
163
|
-
const candidate = join(dir, name);
|
|
164
|
-
if (isExecutableFile(candidate)) return candidate;
|
|
165
|
-
}
|
|
166
|
-
return null;
|
|
167
|
-
}
|
|
168
|
-
function createGlob(pattern) {
|
|
169
|
-
const regex = globToRegExp(pattern);
|
|
170
|
-
return {
|
|
171
|
-
match(path) {
|
|
172
|
-
return regex.test(path);
|
|
173
|
-
},
|
|
174
|
-
scanSync(opts) {
|
|
175
|
-
const dot = opts.dot ?? false;
|
|
176
|
-
const results = [];
|
|
177
|
-
walkDir(opts.cwd, "", dot, results);
|
|
178
|
-
return results.filter((rel) => regex.test(rel));
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
function walkDir(dir, prefix, dot, out) {
|
|
183
|
-
let entries;
|
|
184
|
-
try {
|
|
185
|
-
entries = readdirSync(dir, { withFileTypes: true, encoding: "utf8" });
|
|
186
|
-
} catch {
|
|
187
|
-
return;
|
|
188
|
-
}
|
|
189
|
-
for (const entry of entries) {
|
|
190
|
-
const name = String(entry.name);
|
|
191
|
-
if (!dot && name.startsWith(".")) continue;
|
|
192
|
-
const rel = prefix ? `${prefix}/${name}` : name;
|
|
193
|
-
const full = join(dir, name);
|
|
194
|
-
if (entry.isDirectory()) {
|
|
195
|
-
walkDir(full, rel, dot, out);
|
|
196
|
-
} else if (entry.isFile()) {
|
|
197
|
-
out.push(rel);
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
function globToRegExp(pattern) {
|
|
202
|
-
const trailingDir = pattern.endsWith("/");
|
|
203
|
-
const src = trailingDir ? pattern.slice(0, -1) : pattern;
|
|
204
|
-
const anchored = src.startsWith("/");
|
|
205
|
-
const body = anchored ? src.slice(1) : src;
|
|
206
|
-
let regex = "^";
|
|
207
|
-
if (!anchored) regex += "(?:.*/)?";
|
|
208
|
-
regex += convertBody(body);
|
|
209
|
-
if (trailingDir) {
|
|
210
|
-
regex += "(?:/.*)?";
|
|
211
|
-
}
|
|
212
|
-
regex += "$";
|
|
213
|
-
return new RegExp(regex);
|
|
214
|
-
}
|
|
215
|
-
function convertBody(p) {
|
|
216
|
-
let out = "";
|
|
217
|
-
let i = 0;
|
|
218
|
-
while (i < p.length) {
|
|
219
|
-
const c = p[i];
|
|
220
|
-
if (c === "*") {
|
|
221
|
-
if (p[i + 1] === "*") {
|
|
222
|
-
i += 2;
|
|
223
|
-
if (p[i] === "/") {
|
|
224
|
-
out += "(?:.*/)?";
|
|
225
|
-
i += 1;
|
|
226
|
-
} else {
|
|
227
|
-
out += ".*";
|
|
228
|
-
}
|
|
229
|
-
} else {
|
|
230
|
-
out += "[^/]*";
|
|
231
|
-
i += 1;
|
|
232
|
-
}
|
|
233
|
-
} else if (c === "?") {
|
|
234
|
-
out += "[^/]";
|
|
235
|
-
i += 1;
|
|
236
|
-
} else if (c === "[") {
|
|
237
|
-
out += "[";
|
|
238
|
-
i += 1;
|
|
239
|
-
if (p[i] === "!") {
|
|
240
|
-
out += "^";
|
|
241
|
-
i += 1;
|
|
242
|
-
}
|
|
243
|
-
while (i < p.length && p[i] !== "]") {
|
|
244
|
-
out += p[i] === "\\" ? "\\\\" : p[i];
|
|
245
|
-
i += 1;
|
|
246
|
-
}
|
|
247
|
-
if (p[i] === "]") {
|
|
248
|
-
out += "]";
|
|
249
|
-
i += 1;
|
|
250
|
-
}
|
|
251
|
-
} else if (c === "{") {
|
|
252
|
-
let depth = 1;
|
|
253
|
-
let j = i + 1;
|
|
254
|
-
let bodyStr = "";
|
|
255
|
-
while (j < p.length && depth > 0) {
|
|
256
|
-
if (p[j] === "{") depth += 1;
|
|
257
|
-
else if (p[j] === "}") depth -= 1;
|
|
258
|
-
if (depth > 0) bodyStr += p[j];
|
|
259
|
-
j += 1;
|
|
260
|
-
}
|
|
261
|
-
const alts = bodyStr.split(",").map((alt) => convertBody(alt));
|
|
262
|
-
out += `(?:${alts.join("|")})`;
|
|
263
|
-
i = j;
|
|
264
|
-
} else {
|
|
265
|
-
out += escapeRegexChar(c);
|
|
266
|
-
i += 1;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
return out;
|
|
270
|
-
}
|
|
271
|
-
function escapeRegexChar(c) {
|
|
272
|
-
if ("\\^$.|+()".includes(c)) {
|
|
273
|
-
return `\\${c}`;
|
|
274
|
-
}
|
|
275
|
-
return c;
|
|
276
|
-
}
|
|
277
|
-
function spawnToWebStreams(options) {
|
|
278
|
-
const [command, ...args] = options.cmd;
|
|
279
|
-
const child = spawn(command, args, {
|
|
280
|
-
env: options.env,
|
|
281
|
-
stdio: ["ignore", "pipe", "pipe"]
|
|
282
|
-
});
|
|
283
|
-
const exited = new Promise((resolve) => {
|
|
284
|
-
child.on("exit", (code) => resolve(code ?? 1));
|
|
285
|
-
child.on("error", () => resolve(127));
|
|
286
|
-
});
|
|
287
|
-
const toWeb = (stream) => {
|
|
288
|
-
if (!stream) return null;
|
|
289
|
-
return stream.toWeb?.() ?? new ReadableStream({
|
|
290
|
-
start(controller) {
|
|
291
|
-
stream.on("data", (chunk) => controller.enqueue(new Uint8Array(chunk)));
|
|
292
|
-
stream.on("end", () => controller.close());
|
|
293
|
-
stream.on("error", (e) => controller.error(e));
|
|
294
|
-
}
|
|
295
|
-
});
|
|
296
|
-
};
|
|
297
|
-
return {
|
|
298
|
-
stdout: toWeb(child.stdout),
|
|
299
|
-
stderr: toWeb(child.stderr),
|
|
300
|
-
exited
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
130
|
// packages/agent-runtime/noloWorkspaceTools.ts
|
|
305
131
|
var NOLO_WORKSPACE_TOOL_NAMES = [
|
|
306
132
|
"listDialogs",
|
|
@@ -347,23 +173,23 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
347
173
|
limit: { type: "integer", description: "Maximum dialogs to return." },
|
|
348
174
|
space: stringToolParam("Optional space id or URL.")
|
|
349
175
|
});
|
|
350
|
-
add("readDialog", "Read one persisted dialog in the Nolo workspace.", {
|
|
351
|
-
dialog: stringToolParam("Dialog id, dialog
|
|
176
|
+
add("readDialog", "Read one persisted dialog in the Nolo workspace by full dbKey (dialog-<userId>-<id>) or URL. Use listDialogs first if target is unclear; bare id works for current user only.", {
|
|
177
|
+
dialog: stringToolParam("Dialog dbKey (dialog-<userId>-<id>), dialog URL, or bare id (current user only)."),
|
|
352
178
|
limit: { type: "integer", description: "Optional message limit." }
|
|
353
179
|
}, ["dialog"]);
|
|
354
180
|
add("queryDialogsBySubjectRef", "Query persisted dialog evidence by a generic dialog.subjectRefs target.", {
|
|
355
|
-
rowDbKey: stringToolParam("Optional
|
|
356
|
-
subjectKind: stringToolParam("
|
|
357
|
-
subjectId: stringToolParam("
|
|
181
|
+
rowDbKey: stringToolParam("Optional alias for subjectKind=table-row, subjectId=<rowDbKey>, subjectRole=task."),
|
|
182
|
+
subjectKind: stringToolParam("Subject ref kind (e.g. table-row, page, file, commit, artifact)."),
|
|
183
|
+
subjectId: stringToolParam("Subject ref id."),
|
|
358
184
|
subjectRole: stringToolParam("Optional subject ref role."),
|
|
359
185
|
limit: { type: "integer", description: "Maximum matching dialog summaries to return." },
|
|
360
|
-
status: stringToolParam("Optional dialog status filter
|
|
186
|
+
status: stringToolParam("Optional dialog status filter (running, done, failed)."),
|
|
361
187
|
checkpointStatus: stringToolParam("Optional runtimeCheckpoint.status filter."),
|
|
362
188
|
hasArtifacts: { type: "boolean", description: "When true, only return dialogs with artifact evidence." },
|
|
363
|
-
excludeDialogId: stringToolParam("Optional dialog id
|
|
189
|
+
excludeDialogId: stringToolParam("Optional dialog id to exclude from results.")
|
|
364
190
|
});
|
|
365
|
-
add("deleteDialogs", "Find and delete
|
|
366
|
-
query: stringToolParam("Dialog title/id/dbKey search text
|
|
191
|
+
add("deleteDialogs", "Find and delete dialogs by title/id/dbKey. Preview matches and wait for user confirmation before deleting.", {
|
|
192
|
+
query: stringToolParam("Dialog title/id/dbKey search text."),
|
|
367
193
|
matchMode: {
|
|
368
194
|
type: "string",
|
|
369
195
|
enum: ["contains", "exact", "prefix", "dialogId"],
|
|
@@ -375,16 +201,12 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
375
201
|
description: "Confirmed dialog ids or dbKeys to delete."
|
|
376
202
|
}
|
|
377
203
|
}, ["query"]);
|
|
378
|
-
add("listAgents", "List the current user's agents
|
|
204
|
+
add("listAgents", "List the current user's agents with runnable agentKey for delegation. Copy the agentKey verbatim; do not infer it from the display name.", {
|
|
379
205
|
space: stringToolParam("Optional space id or URL."),
|
|
380
206
|
publicOnly: { type: "boolean", description: "Only show public agents." }
|
|
381
|
-
// 端间差异(LOW-R2-3):CLI 命令 `nolo agent list` 无 --limit(parseAgentListArgs
|
|
382
|
-
// 仅支持 --json/--public-only/--ids-only),本地缓存全量列出;web 端
|
|
383
|
-
// listAgentsFunc 另有 limit(默认 100,最大 500)。如后续对齐需在
|
|
384
|
-
// parseAgentListArgs / agentListCommands 增加 --limit 透传。
|
|
385
207
|
});
|
|
386
|
-
add("readAgent", "Read one agent's full config
|
|
387
|
-
agent: stringToolParam("
|
|
208
|
+
add("readAgent", "Read one agent's full config by exact agentKey returned by listAgents (agent-<userId>-<id> or agent-pub-<id>); do not use the display name.", {
|
|
209
|
+
agent: stringToolParam("Exact agentKey from listAgents (preferred; copy verbatim; plain id or URL are compatibility fallbacks).")
|
|
388
210
|
}, ["agent"]);
|
|
389
211
|
add("listSpaces", "List joined spaces in the Nolo workspace.", {});
|
|
390
212
|
add("readSpace", "Read one space in the Nolo workspace.", {
|
|
@@ -398,8 +220,8 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
398
220
|
add("readSkillDoc", "Read one skill doc in the Nolo workspace.", {
|
|
399
221
|
doc: stringToolParam("Skill doc/page key.")
|
|
400
222
|
}, ["doc"]);
|
|
401
|
-
add("loadSkill", "Load a
|
|
402
|
-
name: stringToolParam("Skill name
|
|
223
|
+
add("loadSkill", "Load a skill by name (.agents/skills/<name>/SKILL.md) and return its full instructions inline. Returns available skills if not found.", {
|
|
224
|
+
name: stringToolParam("Skill name advertised in skill discovery.")
|
|
403
225
|
}, ["name"]);
|
|
404
226
|
add("listTables", "List tables in the current user scope or an optional space scope.", {
|
|
405
227
|
limit: { type: "integer", description: "Maximum tables to return." },
|
|
@@ -760,122 +582,13 @@ function buildNoloWorkspaceCommandArgs(call) {
|
|
|
760
582
|
throw new Error(`Unsupported Nolo workspace tool: ${call.name}`);
|
|
761
583
|
}
|
|
762
584
|
}
|
|
763
|
-
async function readNoloProcessStream(readable) {
|
|
764
|
-
if (!readable) return "";
|
|
765
|
-
return new Response(readable).text();
|
|
766
|
-
}
|
|
767
|
-
async function runNoloWorkspaceCliTool(call, args) {
|
|
768
|
-
const cliArgs = buildNoloWorkspaceCommandArgs(call);
|
|
769
|
-
const bunSpawn = globalThis.Bun?.spawn;
|
|
770
|
-
const spawn2 = args.spawn ?? (typeof bunSpawn === "function" ? bunSpawn : nodeSpawnFallback);
|
|
771
|
-
const execPath = args.processExecPath ?? process.execPath;
|
|
772
|
-
const entrypoint = args.cliEntrypoint;
|
|
773
|
-
const cmd = entrypoint && entrypoint !== execPath ? [execPath, entrypoint, ...cliArgs] : [execPath, ...cliArgs];
|
|
774
|
-
const proc = spawn2({
|
|
775
|
-
cmd,
|
|
776
|
-
stdout: "pipe",
|
|
777
|
-
stderr: "pipe",
|
|
778
|
-
env: args.env
|
|
779
|
-
});
|
|
780
|
-
const [stdout, stderr, exitCode] = await Promise.all([
|
|
781
|
-
readNoloProcessStream(proc.stdout),
|
|
782
|
-
readNoloProcessStream(proc.stderr),
|
|
783
|
-
proc.exited
|
|
784
|
-
]);
|
|
785
|
-
const content = `${stdout}${stderr}`;
|
|
786
|
-
if (exitCode !== 0) {
|
|
787
|
-
throw new Error(content.trim() || `nolo ${cliArgs.join(" ")} exited ${exitCode}`);
|
|
788
|
-
}
|
|
789
|
-
return {
|
|
790
|
-
content,
|
|
791
|
-
metadata: {
|
|
792
|
-
[args.metadataKind ?? "noloWorkspaceTool"]: true,
|
|
793
|
-
command: ["nolo", ...cliArgs].join(" "),
|
|
794
|
-
exitCode
|
|
795
|
-
}
|
|
796
|
-
};
|
|
797
|
-
}
|
|
798
|
-
function buildNoloWorkspaceCliToolExecutors(args) {
|
|
799
|
-
const executors = {};
|
|
800
|
-
for (const toolName of NOLO_WORKSPACE_TOOL_NAMES) {
|
|
801
|
-
if (toolName === "loadSkill") continue;
|
|
802
|
-
executors[toolName] = (call) => runNoloWorkspaceCliTool(call, args);
|
|
803
|
-
}
|
|
804
|
-
return executors;
|
|
805
|
-
}
|
|
806
|
-
function buildLoadSkillExecutor(args) {
|
|
807
|
-
return async (call) => {
|
|
808
|
-
const parsed = parseNoloWorkspaceToolArguments(call.arguments);
|
|
809
|
-
const name = noloStringArg(parsed.name ?? parsed.skillName ?? parsed.skill);
|
|
810
|
-
if (!name) {
|
|
811
|
-
return {
|
|
812
|
-
content: await formatUnknownSkillMessage(args.cwd, "(no name provided)"),
|
|
813
|
-
metadata: { loadSkill: true, resolved: false }
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
const { resolveSkillByName } = await import("./skillDiscovery-KJWT7JBU.js");
|
|
817
|
-
const resolved = resolveSkillByName(args.cwd, name);
|
|
818
|
-
if (!resolved) {
|
|
819
|
-
const { resolveCodingBuiltinSlug, buildCodingSkillContentBySlug } = await import("./codingSkills-36KN5NQT.js");
|
|
820
|
-
const builtinSlug = resolveCodingBuiltinSlug(name);
|
|
821
|
-
if (builtinSlug) {
|
|
822
|
-
const body = buildCodingSkillContentBySlug(builtinSlug);
|
|
823
|
-
return {
|
|
824
|
-
content: `Skill "${name}" loaded inline. Follow its instructions.
|
|
825
|
-
|
|
826
|
-
${body}`,
|
|
827
|
-
metadata: { loadSkill: true, resolved: true, name, requestedName: name, builtin: true }
|
|
828
|
-
};
|
|
829
|
-
}
|
|
830
|
-
return {
|
|
831
|
-
content: await formatUnknownSkillMessage(args.cwd, name),
|
|
832
|
-
metadata: { loadSkill: true, resolved: false, name, requestedName: name }
|
|
833
|
-
};
|
|
834
|
-
}
|
|
835
|
-
try {
|
|
836
|
-
const { readFileSync } = await import("node:fs");
|
|
837
|
-
const body = readFileSync(resolved, "utf8");
|
|
838
|
-
return {
|
|
839
|
-
content: `Skill "${name}" loaded inline. Follow its instructions.
|
|
840
|
-
|
|
841
|
-
${body}`,
|
|
842
|
-
metadata: { loadSkill: true, resolved: true, name, requestedName: name, path: resolved }
|
|
843
|
-
};
|
|
844
|
-
} catch (err) {
|
|
845
|
-
const message = err instanceof Error ? err.message : String(err);
|
|
846
|
-
return {
|
|
847
|
-
content: `Skill "${name}" could not be read: ${message}`,
|
|
848
|
-
metadata: { loadSkill: true, resolved: true, name, requestedName: name, path: resolved, readError: message }
|
|
849
|
-
};
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
}
|
|
853
|
-
async function formatUnknownSkillMessage(cwd, requestedName) {
|
|
854
|
-
const { discoverSkills } = await import("./skillDiscovery-KJWT7JBU.js");
|
|
855
|
-
let available = [];
|
|
856
|
-
try {
|
|
857
|
-
available = discoverSkills(cwd).map((s) => s.name);
|
|
858
|
-
} catch {
|
|
859
|
-
}
|
|
860
|
-
const header = `Skill "${requestedName}" not found in this workspace's skill directory (.agents/skills/<name>/SKILL.md).`;
|
|
861
|
-
if (available.length === 0) return `${header}
|
|
862
|
-
|
|
863
|
-
No skills were discovered in this workspace.`;
|
|
864
|
-
return `${header}
|
|
865
|
-
|
|
866
|
-
Available skills: ${available.join(", ")}`;
|
|
867
|
-
}
|
|
868
|
-
var nodeSpawnFallback = (options) => {
|
|
869
|
-
return spawnToWebStreams({ cmd: options.cmd, env: options.env });
|
|
870
|
-
};
|
|
871
585
|
|
|
872
586
|
export {
|
|
873
587
|
resolveRuntimeToolSurfaceForAgent,
|
|
874
588
|
redactAgentRecordForWorkspaceTool,
|
|
875
|
-
resolveExecutableOnPath,
|
|
876
|
-
createGlob,
|
|
877
589
|
NOLO_WORKSPACE_TOOL_NAMES,
|
|
878
590
|
buildNoloWorkspaceOpenAiTools,
|
|
591
|
+
noloStringArg,
|
|
879
592
|
parseNoloWorkspaceToolArguments,
|
|
880
593
|
clampNoloPositiveInteger,
|
|
881
594
|
getNoloDialogIdFromKey,
|
|
@@ -887,6 +600,5 @@ export {
|
|
|
887
600
|
filterNoloDialogSubjectRefEvidence,
|
|
888
601
|
verifyNoloDialogSubjectRefQuery,
|
|
889
602
|
buildNoloTableQueryRequest,
|
|
890
|
-
|
|
891
|
-
buildLoadSkillExecutor
|
|
603
|
+
buildNoloWorkspaceCommandArgs
|
|
892
604
|
};
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getDefaultProfileConfigPath,
|
|
12
12
|
loadProfileConfig,
|
|
13
13
|
saveDefaultProfile
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-GE6IWA5N.js";
|
|
15
15
|
import {
|
|
16
16
|
resolveAuthTokenFromEnv
|
|
17
17
|
} from "./chunk-A7GB5UGH.js";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
createMemoryOwnerIndexKey,
|
|
24
24
|
createMemorySubjectKindIndexKey,
|
|
25
25
|
memoryOwnerRange
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-NRY4GCKJ.js";
|
|
27
27
|
import {
|
|
28
28
|
asTrimmedNonEmptyStringArray
|
|
29
29
|
} from "./chunk-I42VC5KR.js";
|
|
@@ -7,11 +7,11 @@ import {
|
|
|
7
7
|
listUserRecordsFromServers,
|
|
8
8
|
readDbRecordFromServers,
|
|
9
9
|
readLiveDbRecordAfterTombstoneMerge
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PMCKFQYC.js";
|
|
11
11
|
import {
|
|
12
12
|
buildDialogAttachmentPlan,
|
|
13
13
|
extractFileContentIds
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SIZQB7BD.js";
|
|
15
15
|
import {
|
|
16
16
|
toErrorMessage
|
|
17
17
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -624,9 +624,9 @@ async function tryHttpDialogCandidates(args) {
|
|
|
624
624
|
}
|
|
625
625
|
throw Object.assign(new Error("All HTTP dialog reads failed"), { attempts });
|
|
626
626
|
}
|
|
627
|
-
async function readDialogFromLocalDb(dialogKey, dialogId, limit) {
|
|
628
|
-
const
|
|
629
|
-
const result = await
|
|
627
|
+
async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog) {
|
|
628
|
+
const reader = readLocalDialog ?? (await import("./localDialogRead-JXTAHW2E.js")).readDialogFromLocalDb;
|
|
629
|
+
const result = await reader({ dialogKey, dialogId, limit });
|
|
630
630
|
return {
|
|
631
631
|
...result,
|
|
632
632
|
source: "local-db-fallback"
|
|
@@ -650,18 +650,29 @@ async function readDialogSnapshot(args) {
|
|
|
650
650
|
const statuses = attempts.map((attempt) => attempt.status).filter((status) => typeof status === "number");
|
|
651
651
|
const all404 = attempts.length > 0 && statuses.length === attempts.length && statuses.every((status) => status === 404);
|
|
652
652
|
const localhostCandidate = candidateBases.find(isLocalBaseUrl);
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
653
|
+
const remoteError = Object.assign(new Error(
|
|
654
|
+
all404 ? `dialog not found on tried servers: ${candidateBases.join(", ")}` : `read dialog failed across candidates: ${attempts.map((attempt) => `${attempt.base} -> ${attempt.status ?? attempt.message}`).join("; ")}`
|
|
655
|
+
), { attempts });
|
|
656
|
+
if (all404 || localhostCandidate) {
|
|
657
|
+
try {
|
|
658
|
+
const fallback = await readDialogFromLocalDb(
|
|
659
|
+
args.dialogKey,
|
|
660
|
+
args.dialogId,
|
|
661
|
+
args.limit,
|
|
662
|
+
args.readLocalDialog
|
|
663
|
+
);
|
|
664
|
+
return {
|
|
665
|
+
...fallback,
|
|
666
|
+
// Keep the configured base stable for callers that render it; the
|
|
667
|
+
// source field identifies that the payload came from local storage.
|
|
668
|
+
resolvedBase: localhostCandidate ?? args.base,
|
|
669
|
+
attempts,
|
|
670
|
+
candidateBases
|
|
671
|
+
};
|
|
672
|
+
} catch {
|
|
673
|
+
}
|
|
657
674
|
}
|
|
658
|
-
|
|
659
|
-
return {
|
|
660
|
-
...fallback,
|
|
661
|
-
resolvedBase: localhostCandidate,
|
|
662
|
-
attempts,
|
|
663
|
-
candidateBases
|
|
664
|
-
};
|
|
675
|
+
throw remoteError;
|
|
665
676
|
}
|
|
666
677
|
}
|
|
667
678
|
function compact(value, max = 180) {
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import {
|
|
2
|
+
asTrimmedLowercaseString
|
|
3
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
4
|
+
|
|
5
|
+
// packages/agent-runtime/serverProxyPolicy.ts
|
|
6
|
+
var OAUTH_APIKEY_REFS = /* @__PURE__ */ new Set([
|
|
7
|
+
"antigravity",
|
|
8
|
+
"xai",
|
|
9
|
+
"chatgpt",
|
|
10
|
+
"claude",
|
|
11
|
+
"cursor"
|
|
12
|
+
]);
|
|
13
|
+
function isGoogleFamilyProvider(provider) {
|
|
14
|
+
const normalized = asTrimmedLowercaseString(provider);
|
|
15
|
+
return normalized === "google" || normalized.startsWith("google-");
|
|
16
|
+
}
|
|
17
|
+
function isOAuthApiKeyRef(value) {
|
|
18
|
+
const ref = asTrimmedLowercaseString(value);
|
|
19
|
+
return ref.length > 0 && OAUTH_APIKEY_REFS.has(ref);
|
|
20
|
+
}
|
|
21
|
+
function shouldUseServerProxy(agentConfig, requestProvider) {
|
|
22
|
+
const effectiveProvider = (requestProvider || agentConfig.provider || "").toLowerCase();
|
|
23
|
+
if (isGoogleFamilyProvider(effectiveProvider)) {
|
|
24
|
+
return true;
|
|
25
|
+
}
|
|
26
|
+
if (isOAuthApiKeyRef(agentConfig.apiKeyRef)) {
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
if (agentConfig.apiSource === "custom" && isRemoteCustomEndpoint(agentConfig.customProviderUrl)) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
return !!agentConfig.useServerProxy;
|
|
33
|
+
}
|
|
34
|
+
var LOCAL_HOSTS = /* @__PURE__ */ new Set(["127.0.0.1", "localhost", "::1", "0.0.0.0"]);
|
|
35
|
+
function isRemoteCustomEndpoint(url) {
|
|
36
|
+
if (typeof url !== "string") return false;
|
|
37
|
+
try {
|
|
38
|
+
const host = new URL(url).hostname.toLowerCase();
|
|
39
|
+
return !LOCAL_HOSTS.has(host);
|
|
40
|
+
} catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export {
|
|
46
|
+
isOAuthApiKeyRef,
|
|
47
|
+
shouldUseServerProxy
|
|
48
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
i18n_default,
|
|
3
3
|
toolRegistry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GGB6MPHD.js";
|
|
5
5
|
import {
|
|
6
6
|
canonicalizeToolNames
|
|
7
7
|
} from "./chunk-ZZ2MH7LE.js";
|
|
8
8
|
import {
|
|
9
9
|
isNoloHostedProvider
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-CZHE6LLV.js";
|
|
11
11
|
import {
|
|
12
12
|
asTrimmedLowercaseString
|
|
13
13
|
} from "./chunk-QSJ3HFEF.js";
|