nolo-cli 0.54.0 → 0.61.0-alpha.3
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 +3 -3
- package/{_executeModel-OPTKYHJA.js → _executeModel-R26QYY66.js} +50 -46
- package/{action-ORXWW2ZG.js → action-76JX3JX3.js} +7 -6
- package/{addContentAction-53BZ34AE.js → addContentAction-V3NAZRTJ.js} +6 -5
- package/{addDialogAgentAction-JRYUS54Y.js → addDialogAgentAction-RZOAF46K.js} +5 -4
- package/{agentDeleteCommand-FJIWU2BS.js → agentDeleteCommand-6GNQA4J4.js} +30 -27
- package/{agentEmailCommands-CE32L43B.js → agentEmailCommands-HH67CYKD.js} +61 -57
- package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-R3VQEZJR.js} +1 -1
- package/{agentListCommands-VJNKULIK.js → agentListCommands-23XW3OPZ.js} +61 -31
- package/{agentMachineCommands-HCJ3WQXL.js → agentMachineCommands-HXHASEWO.js} +31 -28
- package/{agentPullCommand-M552CYSI.js → agentPullCommand-N7L2CT7L.js} +2 -2
- package/{agentRecordCommands-QFWERED4.js → agentRecordCommands-UHTQJVGC.js} +59 -55
- package/{agentRunCommand-G3GQMUNN.js → agentRunCommand-OAMT77EX.js} +63 -59
- package/{agentRunControl-INKFDXDA.js → agentRunControl-WECMOO6O.js} +11 -6
- package/{agentRuntimeLocal-K327ELSL.js → agentRuntimeLocal-QBK4H3T2.js} +26 -23
- package/{agentSlice-ODKF4J6M.js → agentSlice-7XJH5WQF.js} +8 -7
- package/{appDeleteCommands-XUXMFDI4.js → appDeleteCommands-AX2O6VDV.js} +30 -27
- package/{appDeployCommands-37F4GPCU.js → appDeployCommands-L5ZR26CB.js} +30 -27
- package/{appDeployStatusCommands-WSPU7TUK.js → appDeployStatusCommands-5HQHELRA.js} +30 -27
- package/{appGetCommands-YLOBA3EM.js → appGetCommands-HVSYOS57.js} +30 -27
- package/{appListCommands-UD62R5ME.js → appListCommands-XV2FPTWX.js} +30 -27
- package/{authCommand-OK6HLHGS.js → authCommand-WOTWLJNF.js} +35 -29
- package/{authCommands-2DUIUEMT.js → authCommands-ILTBI6JV.js} +7 -5
- package/{chatQueueReduxAdapter-TV2TUOQS.js → chatQueueReduxAdapter-F3R253JE.js} +20 -18
- package/{chunk-HPW5MNDQ.js → chunk-22BTGNSP.js} +113 -57
- package/{chunk-UNZDCI3O.js → chunk-2KDR4CWE.js} +35 -4
- package/{chunk-3ZTR7ZO4.js → chunk-2PGGC63K.js} +1 -1
- package/{chunk-EA5OYZVD.js → chunk-37XDGCY7.js} +1 -1
- package/chunk-3BLB7QKO.js +433 -0
- package/{chunk-CS6TCJ7E.js → chunk-3JQ2NRYU.js} +30 -7
- package/{chunk-3LKZRP7E.js → chunk-3QGUVVX5.js} +2 -2
- package/{chunk-SSXTSPSG.js → chunk-45YO6H7P.js} +71 -30
- package/{chunk-YLCUU3WM.js → chunk-4NJEIGBQ.js} +5 -5
- package/{chunk-K4NISKOR.js → chunk-5ZYA4JJ3.js} +47 -17
- package/{chunk-6HIGYUBQ.js → chunk-6XIE5ZGI.js} +1 -1
- package/{chunk-3Y2K5O2R.js → chunk-7A3RRUCQ.js} +125 -40
- package/{chunk-6COJEAYH.js → chunk-7KELZLC2.js} +44 -37
- package/chunk-AETZ7AD6.js +274 -0
- package/chunk-BFU6C242.js +66 -0
- package/{chunk-IA3A5373.js → chunk-C3FZR5EC.js} +1 -1
- package/{chunk-IWUMSAQF.js → chunk-CJCJF5XB.js} +26 -3
- package/{chunk-UGBHDMHI.js → chunk-CP7VIDZ7.js} +1 -1
- package/{chunk-TR4DXUYX.js → chunk-CQ2OZMLQ.js} +1181 -737
- package/{chunk-JON2PHYT.js → chunk-CTCW7U7N.js} +1 -1
- package/{chunk-7NYDJAQ7.js → chunk-DNNSCSA2.js} +5 -5
- package/{chunk-NI2BS6UD.js → chunk-DWUCB2A3.js} +1 -1
- package/{chunk-FJHMLRDQ.js → chunk-DWYSDNOH.js} +22 -28
- package/{chunk-AA564GBL.js → chunk-E3YVTQWT.js} +2 -2
- package/chunk-E4MARS3Q.js +114 -0
- package/{chunk-75MSWWUE.js → chunk-E6RGHPDR.js} +5 -3
- package/chunk-EDKF7RX4.js +30 -0
- package/{chunk-TC6P4NDR.js → chunk-F44FAXP2.js} +6 -6
- package/{chunk-SYYUU7EV.js → chunk-FHAGENAS.js} +2 -3
- package/{chunk-NJUQBYFJ.js → chunk-FKFMIBTT.js} +3 -1
- package/{chunk-INZZJSQF.js → chunk-FZGV4FGK.js} +24 -12
- package/{chunk-6HDYSFLO.js → chunk-GSXDRMDO.js} +3 -3
- package/{chunk-AUVFJGPC.js → chunk-JX5PJCWS.js} +7 -5
- package/{chunk-LYGNQHUW.js → chunk-JYYZCK2Z.js} +2 -4
- package/{chunk-EY7V7REW.js → chunk-KHCLMKZZ.js} +6 -280
- package/{chunk-EJE33XNR.js → chunk-KSCXMC6U.js} +1521 -565
- package/{chunk-XOJRZUPF.js → chunk-KWSQR2KK.js} +14 -29
- package/{chunk-2WBFJHQA.js → chunk-L7B47JXR.js} +34 -39
- package/{chunk-EICIFHVS.js → chunk-LAFC3B2I.js} +1 -1
- package/{chunk-N4JKMCY3.js → chunk-LJKICKVC.js} +2 -2
- package/chunk-M3JEW6N6.js +193 -0
- package/{chunk-LRGKOI5Y.js → chunk-MBOEV4L2.js} +7 -3
- package/{chunk-SVDMVX4G.js → chunk-MMZ6ZTVO.js} +112 -73
- package/{chunk-JDSUTNYY.js → chunk-MP64VFGD.js} +2 -2
- package/{chunk-NFLA6GSU.js → chunk-MXUDQZXQ.js} +44 -5
- package/chunk-N4G4PKQ6.js +23 -0
- package/{chunk-WQHGJHAL.js → chunk-N6HLMLKE.js} +732 -726
- package/{chunk-YQBXOHE6.js → chunk-NO42UD73.js} +1 -1
- package/{chunk-MLEZPE3U.js → chunk-NRRPKMM7.js} +4 -4
- package/{chunk-KXKQO4Q6.js → chunk-NTW5GWDM.js} +58 -1
- package/chunk-ONXOABJR.js +215 -0
- package/{chunk-TY3ADTX5.js → chunk-OZX2IPKM.js} +7 -2
- package/{chunk-Q4XZVZPN.js → chunk-P7OOB7QP.js} +1 -1
- package/{chunk-XIJZOCSP.js → chunk-PEZJEQAO.js} +1 -1
- package/{chunk-SWJGJMTW.js → chunk-PQDIDWGX.js} +1 -1
- package/chunk-PSCNXBYA.js +11 -0
- package/{chunk-BY2FF2C4.js → chunk-QEFJJS2I.js} +55 -73
- package/{chunk-BG7J6Y5X.js → chunk-QEW2MFDQ.js} +1 -1
- package/{chunk-KLIBF3BY.js → chunk-RDBARW6T.js} +8 -3
- package/{chunk-ZVOHVJI3.js → chunk-RJ2SAFB5.js} +82 -35
- package/{chunk-MYMBBB6Q.js → chunk-RVWRKFUB.js} +5 -3
- package/{chunk-43CXXVJD.js → chunk-RXX4GDIH.js} +1 -1
- package/chunk-SEJ5OS6F.js +49 -0
- package/{chunk-JXIP6ZWH.js → chunk-SKIRVYEI.js} +18 -5
- package/{chunk-SAJSBPI2.js → chunk-SOJM57FX.js} +5 -2
- package/{chunk-EKLRRZIN.js → chunk-SPAQ4PVV.js} +0 -5
- package/{chunk-RHMDMTDK.js → chunk-SYNKICCB.js} +2 -2
- package/{chunk-YBFJQC2M.js → chunk-TBHAHL33.js} +65 -42
- package/{chunk-L7NG2M6H.js → chunk-TRV2MIDW.js} +89 -74
- package/{chunk-5UAYZEXO.js → chunk-UZPQSVM6.js} +1 -1
- package/{chunk-7FAS3NEF.js → chunk-VAKVNHK5.js} +19 -15
- package/{chunk-UOWXD4VN.js → chunk-VHO3TMQZ.js} +336 -244
- package/{chunk-SVC3GGUA.js → chunk-VMWYBIXG.js} +7 -5
- package/{chunk-ZHXJ6M7T.js → chunk-W7XHHYWM.js} +4 -0
- package/{chunk-UR66XPVF.js → chunk-XAVSS3KE.js} +21 -3
- package/{chunk-A65UV3M5.js → chunk-XOKOSO35.js} +10 -19
- package/{chunk-VZMUOPYG.js → chunk-XTJTN3RW.js} +46 -3
- package/{chunk-T5HJEUQN.js → chunk-YCDWJX45.js} +1 -1
- package/{chunk-BBTN4NQD.js → chunk-Z4QSJILV.js} +85 -13
- package/{chunk-5FCIPEKT.js → chunk-Z5MHFBJZ.js} +1051 -926
- package/{chunk-O5FLGN2L.js → chunk-ZRSJ3JEH.js} +6 -2
- package/{cliExecutor-BBUVQU4L.js → cliExecutor-HG3S345O.js} +1 -1
- package/{codingSkills-BCQXRZOI.js → codingSkills-TKROLCBA.js} +4 -3
- package/{contentThunks-KNI6VXLT.js → contentThunks-OZPK5B4Z.js} +21 -19
- package/{cooldownCommands-GI5NNWGL.js → cooldownCommands-BSCH2W7P.js} +2 -2
- package/{createAgentAutomationAction-OK4L33KF.js → createAgentAutomationAction-LCIBGE5T.js} +23 -21
- package/{createDialogAction-JDSMY4AY.js → createDialogAction-JPJZMHJE.js} +25 -22
- package/{createPageAction-T7RA3HCG.js → createPageAction-6P2WLNHO.js} +26 -23
- package/{dbSlice-TVX6SN2T.js → dbSlice-IBVOBVMS.js} +5 -4
- package/{deleteFile-JYKRT7C3.js → deleteFile-FWP2PSBG.js} +3 -2
- package/{dialogCommands-UQZYWOOV.js → dialogCommands-WAFKC3KK.js} +30 -27
- package/{dialogSlice-TYW2G7IL.js → dialogSlice-R5RZHFTU.js} +20 -18
- package/{docCreateCommands-OA6HZBWO.js → docCreateCommands-GHGB42S7.js} +32 -28
- package/{docDeleteCommands-KBB3YQI2.js → docDeleteCommands-Y5I7ZEX4.js} +33 -29
- package/{docReadCommands-ZLMFVC67.js → docReadCommands-BMXM6J7T.js} +32 -28
- package/{docStore-2URPBVCS.js → docStore-DKWZ6XJ5.js} +6 -5
- package/{docUpdateCommands-HMH5KUON.js → docUpdateCommands-QNABH3M2.js} +32 -28
- package/{getPricing-RFOPUWHY.js → getPricing-NM3NUTAS.js} +4 -4
- package/handleSendMessageAction-UQGKM4UX.js +675 -0
- package/index.js +79 -88
- package/{lib-2ZTNRXR4.js → lib-FRRS27KN.js} +63 -28
- package/{localRuntimeAuthority-KQDAE64E.js → localRuntimeAuthority-R5UBODT3.js} +6 -4
- package/{localRuntimeDb-PF7CFKDL.js → localRuntimeDb-P37ZTX55.js} +1 -1
- package/{machineCommands-RK6L7ZWL.js → machineCommands-YDAIPYU5.js} +298 -80
- package/{machineWsRunDispatch-3X64DW2Z.js → machineWsRunDispatch-O6RM2ECT.js} +57 -53
- package/{memberThunks-THZYZFSN.js → memberThunks-VZI6G7YZ.js} +10 -8
- package/{models-JVKUEER5.js → models-FAMINFZ7.js} +2 -2
- package/package.json +3 -2
- package/{read-K4JU4MQC.js → read-2BYWW7AA.js} +3 -2
- package/{readDocTool-LQGR6FUN.js → readDocTool-LC3A7QTB.js} +1 -1
- package/{readlineWorkspace-XUFJV3RS.js → readlineWorkspace-5DP3AJWN.js} +4367 -2796
- package/{removeDialogAgentAction-ECHCFB7N.js → removeDialogAgentAction-SFYZXHNK.js} +8 -7
- package/{runAgentClientLoop-24GQ2AW6.js → runAgentClientLoop-Y6HWP2PT.js} +51 -46
- package/{runtimeDoctorCommands-JKTTN723.js → runtimeDoctorCommands-CROTMULY.js} +7 -5
- package/{setDialogExtraReferencesAction-KCVJNGMB.js → setDialogExtraReferencesAction-Q32RGFTA.js} +6 -5
- package/{setPrimaryDialogAgentAction-VDOBOMKC.js → setPrimaryDialogAgentAction-BFYJHUJS.js} +8 -7
- package/{settingSlice-VR2IJSXC.js → settingSlice-IRUU4VFB.js} +6 -5
- package/{skillDiscovery-2QTZINON.js → skillDiscovery-CYUCJMAG.js} +2 -1
- package/{spaceCommands-S5YJJXL7.js → spaceCommands-CLN45IE3.js} +33 -215
- package/{streamAgentChatTurn-QHKP3ABO.js → streamAgentChatTurn-6WFQJ4DY.js} +107 -74
- package/{switchDialogAgentAction-5L4UP7VI.js → switchDialogAgentAction-L2KOKCGG.js} +5 -4
- package/{tableCommands-R6WFRDYF.js → tableCommands-SUNTHAYX.js} +1 -1
- package/{toolApiClient-53U4UDFF.js → toolApiClient-VGYUB4P5.js} +2 -1
- package/{tools-SSXSTC3O.js → tools-RR53D65Q.js} +39 -35
- package/{tuiSummaryLlmCaller-URFJHFC5.js → tuiSummaryLlmCaller-F3DPFFZM.js} +15 -13
- package/{updateCommands-IYKLF3JX.js → updateCommands-AJYSD73Y.js} +2 -2
- package/{updateDialogTitleAction-YFYAEW3T.js → updateDialogTitleAction-WXS3AKOL.js} +23 -21
- package/agentSuperviseCommands-5AR3DKNN.js +0 -640
- package/chunk-6IGD47IC.js +0 -19
- package/chunk-FD36SCCD.js +0 -105
- package/chunk-GRFK2XP4.js +0 -230
- package/chunk-HJTAGT3W.js +0 -370
- package/chunk-SUEIAK5N.js +0 -2574
- package/handleSendMessageAction-GO53TY7U.js +0 -409
|
@@ -1,409 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
messageStreamEnd,
|
|
3
|
-
prepareAndPersistUserMessage,
|
|
4
|
-
resolveHandleSendMessageContext
|
|
5
|
-
} from "./chunk-YBFJQC2M.js";
|
|
6
|
-
import "./chunk-EVBFYPDC.js";
|
|
7
|
-
import "./chunk-HQUORJTM.js";
|
|
8
|
-
import "./chunk-YYLHWIW6.js";
|
|
9
|
-
import "./chunk-AGGIDPCZ.js";
|
|
10
|
-
import {
|
|
11
|
-
streamAgentChatTurn
|
|
12
|
-
} from "./chunk-TC6P4NDR.js";
|
|
13
|
-
import "./chunk-YLCUU3WM.js";
|
|
14
|
-
import "./chunk-5RGU3J7P.js";
|
|
15
|
-
import {
|
|
16
|
-
getActiveDialogKey
|
|
17
|
-
} from "./chunk-6YTOJY35.js";
|
|
18
|
-
import "./chunk-M76ECQRD.js";
|
|
19
|
-
import "./chunk-YDH3FDFQ.js";
|
|
20
|
-
import "./chunk-K4NISKOR.js";
|
|
21
|
-
import "./chunk-BBTN4NQD.js";
|
|
22
|
-
import "./chunk-N4JKMCY3.js";
|
|
23
|
-
import "./chunk-BYXBJQAS.js";
|
|
24
|
-
import "./chunk-SVDMVX4G.js";
|
|
25
|
-
import "./chunk-DWLEOOGR.js";
|
|
26
|
-
import "./chunk-CS6TCJ7E.js";
|
|
27
|
-
import "./chunk-FD36SCCD.js";
|
|
28
|
-
import "./chunk-ZHXJ6M7T.js";
|
|
29
|
-
import "./chunk-HNMXYYJR.js";
|
|
30
|
-
import "./chunk-BYEJ7K2Z.js";
|
|
31
|
-
import "./chunk-NJUQBYFJ.js";
|
|
32
|
-
import "./chunk-HPW5MNDQ.js";
|
|
33
|
-
import "./chunk-SVC3GGUA.js";
|
|
34
|
-
import "./chunk-Y5GCAMGP.js";
|
|
35
|
-
import "./chunk-UZ6XXCVR.js";
|
|
36
|
-
import "./chunk-KX6YBIHG.js";
|
|
37
|
-
import "./chunk-MYMBBB6Q.js";
|
|
38
|
-
import "./chunk-UAD2WT54.js";
|
|
39
|
-
import {
|
|
40
|
-
readAndWait,
|
|
41
|
-
selectById
|
|
42
|
-
} from "./chunk-7NYDJAQ7.js";
|
|
43
|
-
import {
|
|
44
|
-
createDialogMessageKeyAndId
|
|
45
|
-
} from "./chunk-NHRQCXIQ.js";
|
|
46
|
-
import "./chunk-WWC7I6TA.js";
|
|
47
|
-
import "./chunk-I42VC5KR.js";
|
|
48
|
-
import "./chunk-SAJSBPI2.js";
|
|
49
|
-
import "./chunk-QSJ3HFEF.js";
|
|
50
|
-
import "./chunk-2WBFJHQA.js";
|
|
51
|
-
import {
|
|
52
|
-
extractCustomId
|
|
53
|
-
} from "./chunk-BJIRLHJR.js";
|
|
54
|
-
import "./chunk-XOJRZUPF.js";
|
|
55
|
-
import "./chunk-QOKAKDPE.js";
|
|
56
|
-
import "./chunk-OW765XBU.js";
|
|
57
|
-
import "./chunk-GBRG75BQ.js";
|
|
58
|
-
import "./chunk-3EUW3WEO.js";
|
|
59
|
-
import "./chunk-U6VC4MU4.js";
|
|
60
|
-
import "./chunk-KUG52IAP.js";
|
|
61
|
-
import "./chunk-LCBAMY2M.js";
|
|
62
|
-
import "./chunk-4SN6J65J.js";
|
|
63
|
-
import "./chunk-CF7PE763.js";
|
|
64
|
-
import "./chunk-G3SUCT4W.js";
|
|
65
|
-
import "./chunk-4VNS5WPM.js";
|
|
66
|
-
|
|
67
|
-
// packages/chat/dialog/actions/parseOAuthError.ts
|
|
68
|
-
var PROVIDER_NAMES = {
|
|
69
|
-
antigravity: "Antigravity (Google)",
|
|
70
|
-
claude: "Claude",
|
|
71
|
-
chatgpt: "ChatGPT",
|
|
72
|
-
xai: "xAI Grok",
|
|
73
|
-
cursor: "Cursor",
|
|
74
|
-
cloudflare: "Cloudflare"
|
|
75
|
-
};
|
|
76
|
-
function asRecord(value) {
|
|
77
|
-
if (value && typeof value === "object" && !Array.isArray(value)) {
|
|
78
|
-
return value;
|
|
79
|
-
}
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
function asString(value) {
|
|
83
|
-
return typeof value === "string" && value.length > 0 ? value : void 0;
|
|
84
|
-
}
|
|
85
|
-
function collectValidationFromDetails(details) {
|
|
86
|
-
if (!Array.isArray(details)) return {};
|
|
87
|
-
let url;
|
|
88
|
-
let text;
|
|
89
|
-
let learnMoreUrl;
|
|
90
|
-
for (const detail of details) {
|
|
91
|
-
const rec = asRecord(detail);
|
|
92
|
-
if (!rec) continue;
|
|
93
|
-
const metadata = asRecord(rec.metadata);
|
|
94
|
-
if (metadata) {
|
|
95
|
-
url = url ?? asString(metadata.validation_url);
|
|
96
|
-
text = text ?? asString(metadata.validation_url_link_text);
|
|
97
|
-
learnMoreUrl = learnMoreUrl ?? asString(metadata.validation_learn_more_url);
|
|
98
|
-
}
|
|
99
|
-
const help = asRecord(rec);
|
|
100
|
-
if (Array.isArray(help.links)) {
|
|
101
|
-
for (const link of help.links) {
|
|
102
|
-
const linkRec = asRecord(link);
|
|
103
|
-
if (!linkRec) continue;
|
|
104
|
-
const linkUrl = asString(linkRec.url);
|
|
105
|
-
if (!linkUrl) continue;
|
|
106
|
-
const desc = asString(linkRec.description);
|
|
107
|
-
if (!url && desc && /verify|continue/i.test(desc)) {
|
|
108
|
-
url = linkUrl;
|
|
109
|
-
text = desc;
|
|
110
|
-
} else if (!learnMoreUrl && /learn more/i.test(desc ?? "")) {
|
|
111
|
-
learnMoreUrl = linkUrl;
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return { url, text, learnMoreUrl };
|
|
117
|
-
}
|
|
118
|
-
function parseSendError(errorMessage) {
|
|
119
|
-
const summary = errorMessage.replace(/^local\s+/, "").split("\n")[0].trim();
|
|
120
|
-
const providerMatch = errorMessage.match(/local\s+(\w+)\s+OAuth provider failed/i);
|
|
121
|
-
const providerName = providerMatch ? PROVIDER_NAMES[providerMatch[1].toLowerCase()] ?? providerMatch[1] : void 0;
|
|
122
|
-
const statusMatch = errorMessage.match(/HTTP\s+(\d{3})/);
|
|
123
|
-
const status = statusMatch?.[1];
|
|
124
|
-
const jsonStart = errorMessage.indexOf("{");
|
|
125
|
-
let payload = null;
|
|
126
|
-
if (jsonStart >= 0) {
|
|
127
|
-
let candidate = errorMessage.slice(jsonStart);
|
|
128
|
-
for (let depth = 0; depth < 3; depth += 1) {
|
|
129
|
-
try {
|
|
130
|
-
const parsed = JSON.parse(candidate);
|
|
131
|
-
payload = parsed;
|
|
132
|
-
const message = asString(parsed?.error?.message ?? parsed?.message);
|
|
133
|
-
if (message && message.trim().startsWith("{")) {
|
|
134
|
-
candidate = message;
|
|
135
|
-
continue;
|
|
136
|
-
}
|
|
137
|
-
break;
|
|
138
|
-
} catch {
|
|
139
|
-
break;
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
const errorRec = payload ? asRecord(payload.error) : null;
|
|
144
|
-
const innerMessage = errorRec ? asString(errorRec.message) : void 0;
|
|
145
|
-
const statusFromBody = errorRec ? asString(errorRec.status) : void 0;
|
|
146
|
-
const details = errorRec?.details;
|
|
147
|
-
const { url, text, learnMoreUrl } = collectValidationFromDetails(details);
|
|
148
|
-
let reason = errorRec ? asString(errorRec.reason) : void 0;
|
|
149
|
-
let domain = errorRec ? asString(errorRec.domain) : void 0;
|
|
150
|
-
if (!reason && Array.isArray(details)) {
|
|
151
|
-
const first = asRecord(details[0]);
|
|
152
|
-
reason = first ? asString(first.reason) : void 0;
|
|
153
|
-
domain = first ? asString(first.domain) : void 0;
|
|
154
|
-
}
|
|
155
|
-
const parts = [];
|
|
156
|
-
const head = providerName ? `${providerName} \u8FDE\u63A5\u5931\u8D25` : "\u53D1\u9001\u5931\u8D25";
|
|
157
|
-
parts.push(
|
|
158
|
-
`${head}${status ? ` (HTTP ${status})` : ""}${statusFromBody ? ` ${statusFromBody}` : ""}`
|
|
159
|
-
);
|
|
160
|
-
if (reason) {
|
|
161
|
-
parts.push(`\u539F\u56E0\uFF1A${reason}`);
|
|
162
|
-
}
|
|
163
|
-
if (domain) {
|
|
164
|
-
parts.push(`\u670D\u52A1\uFF1A${domain}`);
|
|
165
|
-
}
|
|
166
|
-
const humanMessage = innerMessage && innerMessage.trim() !== "Verify your account to continue." ? innerMessage : void 0;
|
|
167
|
-
if (humanMessage) {
|
|
168
|
-
parts.push(`\u63D0\u793A\uFF1A${humanMessage}`);
|
|
169
|
-
}
|
|
170
|
-
const extraLinks = [];
|
|
171
|
-
if (learnMoreUrl) {
|
|
172
|
-
extraLinks.push({ text: "\u4E86\u89E3\u66F4\u591A", url: learnMoreUrl });
|
|
173
|
-
}
|
|
174
|
-
if (url) {
|
|
175
|
-
return {
|
|
176
|
-
summary: parts.join("\n"),
|
|
177
|
-
validationUrl: url,
|
|
178
|
-
validationLinkText: text ?? "\u9A8C\u8BC1\u6211\u7684\u8D26\u53F7",
|
|
179
|
-
extraLinks
|
|
180
|
-
};
|
|
181
|
-
}
|
|
182
|
-
const MAX_FALLBACK = 500;
|
|
183
|
-
const fallbackText = errorMessage.length > MAX_FALLBACK ? `${errorMessage.slice(0, MAX_FALLBACK)}\u2026` : errorMessage;
|
|
184
|
-
return { summary: parts.join("\n"), extraLinks, fallbackText };
|
|
185
|
-
}
|
|
186
|
-
function buildSendErrorMessageMarkdown(parsed) {
|
|
187
|
-
const lines = ["[\u53D1\u9001\u5931\u8D25]", "", parsed.summary];
|
|
188
|
-
if (parsed.validationUrl) {
|
|
189
|
-
lines.push(
|
|
190
|
-
"",
|
|
191
|
-
`\u8BF7\u70B9\u51FB\u94FE\u63A5\u5B8C\u6210\u9A8C\u8BC1\uFF1A`,
|
|
192
|
-
`- [${parsed.validationLinkText ?? "\u9A8C\u8BC1\u6211\u7684\u8D26\u53F7"}](${parsed.validationUrl})`
|
|
193
|
-
);
|
|
194
|
-
}
|
|
195
|
-
for (const link of parsed.extraLinks) {
|
|
196
|
-
lines.push(`- [${link.text}](${link.url})`);
|
|
197
|
-
}
|
|
198
|
-
if (parsed.fallbackText && !parsed.validationUrl) {
|
|
199
|
-
lines.push("", "```", parsed.fallbackText, "```");
|
|
200
|
-
}
|
|
201
|
-
return lines.join("\n");
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
// packages/chat/dialog/actions/handleSendMessageAction.ts
|
|
205
|
-
var getDialogConfig = (state, dialogKey) => {
|
|
206
|
-
const resolvedDialogKey = dialogKey ?? getActiveDialogKey();
|
|
207
|
-
if (!resolvedDialogKey) return null;
|
|
208
|
-
const dialog = selectById(state, resolvedDialogKey);
|
|
209
|
-
return dialog ?? null;
|
|
210
|
-
};
|
|
211
|
-
var ensureDialogConfig = async (dispatch, getState, dialogKey) => {
|
|
212
|
-
const state = getState();
|
|
213
|
-
const resolvedDialogKey = dialogKey ?? getActiveDialogKey();
|
|
214
|
-
if (!resolvedDialogKey) return null;
|
|
215
|
-
try {
|
|
216
|
-
const existingDialog = getDialogConfig(state, resolvedDialogKey);
|
|
217
|
-
if (existingDialog && Array.isArray(existingDialog.cybots) && existingDialog.cybots.length > 0) {
|
|
218
|
-
return existingDialog;
|
|
219
|
-
}
|
|
220
|
-
const persistedDialog = await dispatch(readAndWait(resolvedDialogKey)).unwrap();
|
|
221
|
-
if (persistedDialog) return persistedDialog;
|
|
222
|
-
return existingDialog;
|
|
223
|
-
} catch {
|
|
224
|
-
return getDialogConfig(getState(), resolvedDialogKey);
|
|
225
|
-
}
|
|
226
|
-
};
|
|
227
|
-
var logQuickChatPerfStage = (startedAt, stage, details = {}) => {
|
|
228
|
-
if (!startedAt) return;
|
|
229
|
-
const now = typeof performance !== "undefined" ? performance.now() : Date.now();
|
|
230
|
-
console.info("[QuickChatPerf]", {
|
|
231
|
-
stage,
|
|
232
|
-
elapsedMs: now - startedAt,
|
|
233
|
-
...typeof performance !== "undefined" ? { atMs: now } : {},
|
|
234
|
-
...details
|
|
235
|
-
});
|
|
236
|
-
};
|
|
237
|
-
var resolveBrowseContextPrefix = async (message) => {
|
|
238
|
-
try {
|
|
239
|
-
if (typeof window === "undefined" || typeof location === "undefined") return "";
|
|
240
|
-
if (typeof process !== "undefined" && (process.env?.NODE_ENV === "test" || process.env?.BUN_TEST)) return "";
|
|
241
|
-
const host = location.hostname;
|
|
242
|
-
if (host !== "127.0.0.1" && host !== "localhost") return "";
|
|
243
|
-
if (typeof fetch !== "function" || typeof AbortSignal?.timeout !== "function") return "";
|
|
244
|
-
const response = await fetch("/api/desktop/browse-context", {
|
|
245
|
-
method: "POST",
|
|
246
|
-
headers: { "Content-Type": "application/json" },
|
|
247
|
-
body: JSON.stringify({ message }),
|
|
248
|
-
signal: AbortSignal.timeout(2e3)
|
|
249
|
-
});
|
|
250
|
-
if (!response.ok) return "";
|
|
251
|
-
const payload = await response.json();
|
|
252
|
-
if (!payload.context || !payload.context.url) return "";
|
|
253
|
-
const ctx = payload.context;
|
|
254
|
-
const parts = [`[\u5F53\u524D\u6D4F\u89C8\u4E0A\u4E0B\u6587]`, `URL: ${ctx.url}`, `\u6807\u9898: ${ctx.title}`];
|
|
255
|
-
if (ctx.textSnippet) parts.push(`\u6458\u8981: ${ctx.textSnippet.slice(0, 2e3)}`);
|
|
256
|
-
return parts.join("\n");
|
|
257
|
-
} catch {
|
|
258
|
-
return "";
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
var finalizeQuickChatStreamStartupFailure = async (dispatch, dialogConfig, agentKey) => {
|
|
262
|
-
const dialogKey = dialogConfig.dbKey;
|
|
263
|
-
const dialogId = dialogConfig.id ?? (dialogKey ? extractCustomId(dialogKey) : "");
|
|
264
|
-
const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
|
|
265
|
-
await dispatch(
|
|
266
|
-
messageStreamEnd({
|
|
267
|
-
finalContentBuffer: [
|
|
268
|
-
{
|
|
269
|
-
type: "text",
|
|
270
|
-
text: "[\u9519\u8BEF: \u672A\u80FD\u542F\u52A8\u6A21\u578B\u56DE\u590D\uFF0C\u8BF7\u91CD\u8BD5\u3002]"
|
|
271
|
-
}
|
|
272
|
-
],
|
|
273
|
-
totalUsage: null,
|
|
274
|
-
msgKey,
|
|
275
|
-
agentConfig: {
|
|
276
|
-
dbKey: agentKey
|
|
277
|
-
},
|
|
278
|
-
dialogId,
|
|
279
|
-
dialogKey: dialogKey ?? "",
|
|
280
|
-
messageId,
|
|
281
|
-
reasoningBuffer: ""
|
|
282
|
-
})
|
|
283
|
-
).unwrap?.();
|
|
284
|
-
};
|
|
285
|
-
var buildActionableErrorText = (errorMessage) => {
|
|
286
|
-
return buildSendErrorMessageMarkdown(parseSendError(errorMessage));
|
|
287
|
-
};
|
|
288
|
-
var finalizeSendFailureInDialog = async (dispatch, dialogConfig, agentKey, errorMessage) => {
|
|
289
|
-
const dialogKey = dialogConfig.dbKey;
|
|
290
|
-
const dialogId = dialogConfig.id ?? (dialogKey ? extractCustomId(dialogKey) : "");
|
|
291
|
-
const { key: msgKey, messageId } = createDialogMessageKeyAndId(dialogId);
|
|
292
|
-
await dispatch(
|
|
293
|
-
messageStreamEnd({
|
|
294
|
-
finalContentBuffer: [
|
|
295
|
-
{
|
|
296
|
-
type: "text",
|
|
297
|
-
text: `[\u53D1\u9001\u5931\u8D25]
|
|
298
|
-
|
|
299
|
-
${buildActionableErrorText(errorMessage)}`
|
|
300
|
-
}
|
|
301
|
-
],
|
|
302
|
-
totalUsage: null,
|
|
303
|
-
msgKey,
|
|
304
|
-
agentConfig: {
|
|
305
|
-
dbKey: agentKey
|
|
306
|
-
},
|
|
307
|
-
dialogId,
|
|
308
|
-
dialogKey: dialogKey ?? "",
|
|
309
|
-
messageId,
|
|
310
|
-
reasoningBuffer: ""
|
|
311
|
-
})
|
|
312
|
-
).unwrap?.();
|
|
313
|
-
};
|
|
314
|
-
var handleSendMessageAction = async (args, { dispatch, getState, rejectWithValue }) => {
|
|
315
|
-
let dialogConfig = null;
|
|
316
|
-
let agentKeyToUse;
|
|
317
|
-
try {
|
|
318
|
-
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-entered", {
|
|
319
|
-
dialogKey: args.dialogKey ?? null
|
|
320
|
-
});
|
|
321
|
-
dialogConfig = await ensureDialogConfig(dispatch, getState, args.dialogKey);
|
|
322
|
-
if (!dialogConfig) {
|
|
323
|
-
throw new Error(
|
|
324
|
-
"handleSendMessage: Dialog configuration is missing."
|
|
325
|
-
);
|
|
326
|
-
}
|
|
327
|
-
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-dialog-ready", {
|
|
328
|
-
dialogKey: dialogConfig.dbKey,
|
|
329
|
-
cybotCount: dialogConfig.cybots?.length ?? 0
|
|
330
|
-
});
|
|
331
|
-
await dispatch(
|
|
332
|
-
prepareAndPersistUserMessage({
|
|
333
|
-
userInput: args.userInput,
|
|
334
|
-
dialogConfig
|
|
335
|
-
})
|
|
336
|
-
).unwrap();
|
|
337
|
-
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-user-persisted", {
|
|
338
|
-
dialogKey: dialogConfig.dbKey
|
|
339
|
-
});
|
|
340
|
-
const resolvedContext = resolveHandleSendMessageContext({
|
|
341
|
-
dialogConfig,
|
|
342
|
-
targetAgentKey: args.targetAgentKey,
|
|
343
|
-
runtimeOptions: args.runtimeOptions
|
|
344
|
-
});
|
|
345
|
-
agentKeyToUse = resolvedContext.agentKeyToUse;
|
|
346
|
-
const agentConfigToUse = resolvedContext.agentConfigToUse;
|
|
347
|
-
const effectiveRuntimeOptions = resolvedContext.effectiveRuntimeOptions;
|
|
348
|
-
if (!agentKeyToUse) {
|
|
349
|
-
return;
|
|
350
|
-
}
|
|
351
|
-
const userInputText = typeof args.userInput === "string" ? args.userInput : "";
|
|
352
|
-
const isDesktopContext = typeof window !== "undefined" && typeof location !== "undefined" && (location.hostname === "127.0.0.1" || location.hostname === "localhost");
|
|
353
|
-
const browseContextPrefix = isDesktopContext ? await resolveBrowseContextPrefix(userInputText) : "";
|
|
354
|
-
const effectiveUserInput = browseContextPrefix ? `${browseContextPrefix}
|
|
355
|
-
|
|
356
|
-
${userInputText}` : args.userInput;
|
|
357
|
-
const streamResult = await dispatch(
|
|
358
|
-
streamAgentChatTurn({
|
|
359
|
-
agentKey: agentKeyToUse,
|
|
360
|
-
...agentConfigToUse ? { agentConfig: agentConfigToUse } : {},
|
|
361
|
-
userInput: effectiveUserInput,
|
|
362
|
-
dialogKey: dialogConfig.dbKey,
|
|
363
|
-
parentMessageId: void 0,
|
|
364
|
-
runtimeOptions: effectiveRuntimeOptions,
|
|
365
|
-
quickChatPerfStartedAt: args.quickChatPerfStartedAt
|
|
366
|
-
})
|
|
367
|
-
).unwrap();
|
|
368
|
-
if (args.quickChatPerfStartedAt && streamResult === void 0) {
|
|
369
|
-
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-stream-empty", {
|
|
370
|
-
dialogKey: dialogConfig.dbKey,
|
|
371
|
-
agentKey: agentKeyToUse
|
|
372
|
-
});
|
|
373
|
-
await finalizeQuickChatStreamStartupFailure(
|
|
374
|
-
dispatch,
|
|
375
|
-
dialogConfig,
|
|
376
|
-
agentKeyToUse
|
|
377
|
-
);
|
|
378
|
-
return;
|
|
379
|
-
}
|
|
380
|
-
logQuickChatPerfStage(args.quickChatPerfStartedAt, "handle-send-message-stream-finished", {
|
|
381
|
-
dialogKey: dialogConfig.dbKey,
|
|
382
|
-
agentKey: agentKeyToUse
|
|
383
|
-
});
|
|
384
|
-
return;
|
|
385
|
-
} catch (error) {
|
|
386
|
-
console.error("handleSendMessage failed:", error);
|
|
387
|
-
const errorMessage = error instanceof Error ? error.message : typeof error === "string" ? error : error?.message || error?.error || String(error);
|
|
388
|
-
try {
|
|
389
|
-
if (dialogConfig && agentKeyToUse) {
|
|
390
|
-
await finalizeSendFailureInDialog(
|
|
391
|
-
dispatch,
|
|
392
|
-
dialogConfig,
|
|
393
|
-
agentKeyToUse,
|
|
394
|
-
errorMessage
|
|
395
|
-
);
|
|
396
|
-
return rejectWithValue({
|
|
397
|
-
__errorInDialog: true,
|
|
398
|
-
message: errorMessage
|
|
399
|
-
});
|
|
400
|
-
}
|
|
401
|
-
} catch (writeError) {
|
|
402
|
-
console.error("handleSendMessage: failed to write error into dialog:", writeError);
|
|
403
|
-
}
|
|
404
|
-
return rejectWithValue(errorMessage);
|
|
405
|
-
}
|
|
406
|
-
};
|
|
407
|
-
export {
|
|
408
|
-
handleSendMessageAction
|
|
409
|
-
};
|