nolo-cli 0.54.0 → 0.61.0-alpha.2
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-CKT6RGTL.js} +48 -45
- 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-VN7NPXQ4.js} +30 -27
- package/{agentEmailCommands-CE32L43B.js → agentEmailCommands-F2TNAV4A.js} +59 -56
- package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-R3VQEZJR.js} +1 -1
- package/{agentListCommands-VJNKULIK.js → agentListCommands-OSM2ANI3.js} +61 -31
- package/{agentMachineCommands-HCJ3WQXL.js → agentMachineCommands-MTPWYVRV.js} +31 -28
- package/{agentPullCommand-M552CYSI.js → agentPullCommand-N7L2CT7L.js} +2 -2
- package/{agentRecordCommands-QFWERED4.js → agentRecordCommands-VWAWTVVC.js} +57 -54
- package/{agentRunCommand-G3GQMUNN.js → agentRunCommand-PLZOBNVK.js} +61 -58
- package/{agentRunControl-INKFDXDA.js → agentRunControl-WECMOO6O.js} +11 -6
- package/{agentRuntimeLocal-K327ELSL.js → agentRuntimeLocal-XCJLRWQE.js} +26 -23
- package/{agentSlice-ODKF4J6M.js → agentSlice-F6DOP4IW.js} +8 -7
- package/{appDeleteCommands-XUXMFDI4.js → appDeleteCommands-3BCFTRFJ.js} +30 -27
- package/{appDeployCommands-37F4GPCU.js → appDeployCommands-B4GMHCYA.js} +30 -27
- package/{appDeployStatusCommands-WSPU7TUK.js → appDeployStatusCommands-4MN36WIG.js} +30 -27
- package/{appGetCommands-YLOBA3EM.js → appGetCommands-4GJIEUAX.js} +30 -27
- package/{appListCommands-UD62R5ME.js → appListCommands-CHU53GSX.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-HNSQXNIR.js} +20 -18
- package/{chunk-HPW5MNDQ.js → chunk-22BTGNSP.js} +113 -57
- package/{chunk-TR4DXUYX.js → chunk-2HPRMEEZ.js} +1180 -736
- package/{chunk-UNZDCI3O.js → chunk-2KDR4CWE.js} +35 -4
- package/{chunk-3ZTR7ZO4.js → chunk-2PGGC63K.js} +1 -1
- package/{chunk-JXIP6ZWH.js → chunk-37QVS7BU.js} +18 -5
- 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-RHMDMTDK.js → chunk-3JWKQDA4.js} +2 -2
- package/{chunk-3LKZRP7E.js → chunk-3QGUVVX5.js} +2 -2
- package/{chunk-SSXTSPSG.js → chunk-45YO6H7P.js} +71 -30
- package/{chunk-EJE33XNR.js → chunk-4C4ST2YE.js} +1521 -565
- package/{chunk-YLCUU3WM.js → chunk-4NJEIGBQ.js} +5 -5
- package/{chunk-K4NISKOR.js → chunk-5ZYA4JJ3.js} +47 -17
- package/{chunk-3Y2K5O2R.js → chunk-7A3RRUCQ.js} +125 -40
- package/{chunk-5FCIPEKT.js → chunk-7O7KH4X5.js} +1051 -926
- package/{chunk-6HDYSFLO.js → chunk-7UF7CQ6B.js} +3 -3
- package/{chunk-SUEIAK5N.js → chunk-AQMVUA7N.js} +1 -0
- package/{chunk-WQHGJHAL.js → chunk-AVE2YR4F.js} +732 -726
- package/{chunk-6COJEAYH.js → chunk-B7DXRX7F.js} +44 -37
- 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-JON2PHYT.js → chunk-CTCW7U7N.js} +1 -1
- package/{chunk-YBFJQC2M.js → chunk-D5XKNNUV.js} +65 -42
- package/{chunk-7NYDJAQ7.js → chunk-DNNSCSA2.js} +5 -5
- package/{chunk-NI2BS6UD.js → chunk-DWUCB2A3.js} +1 -1
- package/{chunk-AA564GBL.js → chunk-DZZL7UBV.js} +1 -1
- package/{chunk-75MSWWUE.js → chunk-E6RGHPDR.js} +5 -3
- package/chunk-EDKF7RX4.js +30 -0
- package/{chunk-FJHMLRDQ.js → chunk-ES6CVKVD.js} +21 -27
- 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-YQBXOHE6.js → chunk-GAL47RNP.js} +1 -1
- package/{chunk-UOWXD4VN.js → chunk-HBPV76EK.js} +335 -243
- package/{chunk-MLEZPE3U.js → chunk-HLU5Q2GV.js} +4 -4
- package/{chunk-TC6P4NDR.js → chunk-HQP7HJDL.js} +6 -6
- package/{chunk-7FAS3NEF.js → chunk-IYCUMIYS.js} +19 -15
- package/{chunk-AUVFJGPC.js → chunk-JX5PJCWS.js} +7 -5
- package/{chunk-LYGNQHUW.js → chunk-JYYZCK2Z.js} +2 -4
- 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-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-SAJSBPI2.js → chunk-SOJM57FX.js} +5 -2
- package/{chunk-EKLRRZIN.js → chunk-SPAQ4PVV.js} +0 -5
- package/{chunk-L7NG2M6H.js → chunk-TRV2MIDW.js} +89 -74
- package/{chunk-5UAYZEXO.js → chunk-UZPQSVM6.js} +1 -1
- 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-O5FLGN2L.js → chunk-ZRSJ3JEH.js} +6 -2
- package/{cliExecutor-BBUVQU4L.js → cliExecutor-HG3S345O.js} +1 -1
- package/{codingSkills-BCQXRZOI.js → codingSkills-VDXQYWX4.js} +2 -2
- package/{contentThunks-KNI6VXLT.js → contentThunks-7YG2ZYQC.js} +21 -19
- package/{cooldownCommands-GI5NNWGL.js → cooldownCommands-BSCH2W7P.js} +2 -2
- package/{createAgentAutomationAction-OK4L33KF.js → createAgentAutomationAction-PJQSCAIO.js} +23 -21
- package/{createDialogAction-JDSMY4AY.js → createDialogAction-SFEJX6SP.js} +23 -21
- package/{createPageAction-T7RA3HCG.js → createPageAction-B7WRHOQO.js} +24 -22
- package/{dbSlice-TVX6SN2T.js → dbSlice-IBVOBVMS.js} +5 -4
- package/{deleteFile-JYKRT7C3.js → deleteFile-FWP2PSBG.js} +3 -2
- package/{dialogCommands-UQZYWOOV.js → dialogCommands-VL2X22QC.js} +30 -27
- package/{dialogSlice-TYW2G7IL.js → dialogSlice-ANMACABO.js} +20 -18
- package/{docCreateCommands-OA6HZBWO.js → docCreateCommands-ITLGZ5YI.js} +29 -26
- package/{docDeleteCommands-KBB3YQI2.js → docDeleteCommands-LH3YNL4C.js} +30 -27
- package/{docReadCommands-ZLMFVC67.js → docReadCommands-YAJ77F36.js} +29 -26
- package/{docStore-2URPBVCS.js → docStore-D4HGHPWI.js} +6 -5
- package/{docUpdateCommands-HMH5KUON.js → docUpdateCommands-DQBOMH2G.js} +29 -26
- package/{getPricing-RFOPUWHY.js → getPricing-NM3NUTAS.js} +4 -4
- package/handleSendMessageAction-DF2OABGW.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-JXDYQ5LB.js} +296 -79
- package/{machineWsRunDispatch-3X64DW2Z.js → machineWsRunDispatch-3QHI7JX5.js} +55 -52
- 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-KVZTEAHB.js} +4365 -2795
- package/{removeDialogAgentAction-ECHCFB7N.js → removeDialogAgentAction-SFYZXHNK.js} +8 -7
- package/{runAgentClientLoop-24GQ2AW6.js → runAgentClientLoop-KGTEL7ZP.js} +49 -45
- 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-NTRLM6KP.js} +1 -1
- package/{spaceCommands-S5YJJXL7.js → spaceCommands-KNAYWMCZ.js} +33 -215
- package/{streamAgentChatTurn-QHKP3ABO.js → streamAgentChatTurn-FLYPTXKZ.js} +105 -73
- 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-CVLUXK6P.js} +37 -34
- package/{tuiSummaryLlmCaller-URFJHFC5.js → tuiSummaryLlmCaller-F3DPFFZM.js} +15 -13
- package/{updateCommands-IYKLF3JX.js → updateCommands-AJYSD73Y.js} +2 -2
- package/{updateDialogTitleAction-YFYAEW3T.js → updateDialogTitleAction-HWJIZEIV.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/handleSendMessageAction-GO53TY7U.js +0 -409
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
resolveNoloHome
|
|
3
|
-
} from "./chunk-GLKOYSRU.js";
|
|
4
|
-
|
|
5
1
|
// packages/database-engine/cliAuthorityBrokerClient.ts
|
|
6
2
|
import { createConnection } from "node:net";
|
|
7
3
|
var DEFAULT_ITERATOR_PAGE_SIZE = 200;
|
|
@@ -18,6 +14,20 @@ var CliAuthorityBrokerUnavailableError = class extends Error {
|
|
|
18
14
|
}
|
|
19
15
|
}
|
|
20
16
|
};
|
|
17
|
+
var CliAuthorityBrokerTimeoutError = class extends Error {
|
|
18
|
+
reason = "cli_authority_broker_timeout";
|
|
19
|
+
endpoint;
|
|
20
|
+
timeoutMs;
|
|
21
|
+
constructor(endpoint, timeoutMs, cause) {
|
|
22
|
+
super(`CLI authority broker request at ${endpoint} timed out after ${timeoutMs}ms`);
|
|
23
|
+
this.name = "CliAuthorityBrokerTimeoutError";
|
|
24
|
+
this.endpoint = endpoint;
|
|
25
|
+
this.timeoutMs = timeoutMs;
|
|
26
|
+
if (cause !== void 0) {
|
|
27
|
+
this.cause = cause;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
};
|
|
21
31
|
var CliAuthorityBrokerProtocolError = class extends Error {
|
|
22
32
|
code;
|
|
23
33
|
retryable;
|
|
@@ -31,8 +41,30 @@ var CliAuthorityBrokerProtocolError = class extends Error {
|
|
|
31
41
|
function isCliAuthorityBrokerUnavailableError(error) {
|
|
32
42
|
return error instanceof CliAuthorityBrokerUnavailableError || typeof error === "object" && error !== null && error.reason === "cli_authority_broker_unavailable" && error.status === 503;
|
|
33
43
|
}
|
|
44
|
+
function isCliAuthorityBrokerTimeoutError(error) {
|
|
45
|
+
return error instanceof CliAuthorityBrokerTimeoutError || typeof error === "object" && error !== null && error.reason === "cli_authority_broker_timeout";
|
|
46
|
+
}
|
|
34
47
|
function isCliAuthorityBrokerProtocolError(error) {
|
|
35
|
-
return error instanceof CliAuthorityBrokerProtocolError;
|
|
48
|
+
return error instanceof CliAuthorityBrokerProtocolError || typeof error === "object" && error !== null && error.name === "CliAuthorityBrokerProtocolError";
|
|
49
|
+
}
|
|
50
|
+
function isBrokerUnavailableCause(error) {
|
|
51
|
+
if (!error) return false;
|
|
52
|
+
if (isCliAuthorityBrokerTimeoutError(error) || isCliAuthorityBrokerProtocolError(error)) {
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
if (isCliAuthorityBrokerUnavailableError(error)) {
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
if (typeof error === "object") {
|
|
59
|
+
const code = error.code;
|
|
60
|
+
if (typeof code === "string" && /^(ECONNREFUSED|ENOENT|ECONNRESET|EPIPE|EADDRNOTAVAIL|ENETUNREACH|EHOSTUNREACH)$/i.test(code)) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
65
|
+
if (/timed out/i.test(message)) return false;
|
|
66
|
+
if (/malformed response|protocol mismatch/i.test(message)) return false;
|
|
67
|
+
return /ECONNREFUSED|ENOENT|ECONNRESET|EPIPE|closed connection without response|returned no response/i.test(message);
|
|
36
68
|
}
|
|
37
69
|
function resolveBrokerSocketTarget(endpoint) {
|
|
38
70
|
if (endpoint.startsWith("unix://")) {
|
|
@@ -50,6 +82,7 @@ function resolveBrokerSocketTarget(endpoint) {
|
|
|
50
82
|
}
|
|
51
83
|
function createCliAuthorityBrokerSocketInvoker(options) {
|
|
52
84
|
const target = resolveBrokerSocketTarget(options.endpoint);
|
|
85
|
+
const timeoutMs = options.timeoutMs ?? 5e3;
|
|
53
86
|
return async (request) => {
|
|
54
87
|
return await new Promise((resolve, reject) => {
|
|
55
88
|
const socket = target.kind === "unix" ? createConnection(target.path) : createConnection({ host: target.host, port: target.port });
|
|
@@ -58,9 +91,9 @@ function createCliAuthorityBrokerSocketInvoker(options) {
|
|
|
58
91
|
const timeout = setTimeout(() => {
|
|
59
92
|
finish(() => {
|
|
60
93
|
socket.destroy();
|
|
61
|
-
reject(new
|
|
94
|
+
reject(new CliAuthorityBrokerTimeoutError(options.endpoint, timeoutMs));
|
|
62
95
|
});
|
|
63
|
-
},
|
|
96
|
+
}, timeoutMs);
|
|
64
97
|
const finish = (fn) => {
|
|
65
98
|
if (settled) return;
|
|
66
99
|
settled = true;
|
|
@@ -79,18 +112,34 @@ function createCliAuthorityBrokerSocketInvoker(options) {
|
|
|
79
112
|
finish(() => {
|
|
80
113
|
const payload = responseBuffer.trim();
|
|
81
114
|
if (!payload) {
|
|
82
|
-
reject(
|
|
115
|
+
reject(
|
|
116
|
+
new CliAuthorityBrokerUnavailableError(
|
|
117
|
+
options.endpoint,
|
|
118
|
+
new Error(`CLI authority broker at ${options.endpoint} closed connection without response`)
|
|
119
|
+
)
|
|
120
|
+
);
|
|
83
121
|
return;
|
|
84
122
|
}
|
|
85
123
|
try {
|
|
86
124
|
resolve(JSON.parse(payload));
|
|
87
|
-
} catch (
|
|
88
|
-
reject(
|
|
125
|
+
} catch (parseError) {
|
|
126
|
+
reject(
|
|
127
|
+
new CliAuthorityBrokerProtocolError({
|
|
128
|
+
code: "MALFORMED_RESPONSE",
|
|
129
|
+
message: `CLI authority broker at ${options.endpoint} returned malformed response: ${parseError instanceof Error ? parseError.message : String(parseError)}`
|
|
130
|
+
})
|
|
131
|
+
);
|
|
89
132
|
}
|
|
90
133
|
});
|
|
91
134
|
});
|
|
92
135
|
socket.on("error", (error) => {
|
|
93
|
-
finish(() =>
|
|
136
|
+
finish(() => {
|
|
137
|
+
if (isBrokerUnavailableCause(error)) {
|
|
138
|
+
reject(new CliAuthorityBrokerUnavailableError(options.endpoint, error));
|
|
139
|
+
} else {
|
|
140
|
+
reject(error);
|
|
141
|
+
}
|
|
142
|
+
});
|
|
94
143
|
});
|
|
95
144
|
});
|
|
96
145
|
};
|
|
@@ -98,15 +147,39 @@ function createCliAuthorityBrokerSocketInvoker(options) {
|
|
|
98
147
|
async function invokeBrokerRequest(options, request) {
|
|
99
148
|
try {
|
|
100
149
|
const response = await options.invoke(request);
|
|
101
|
-
if (response.ok)
|
|
150
|
+
if (!response || typeof response !== "object" || typeof response.ok !== "boolean") {
|
|
151
|
+
throw new CliAuthorityBrokerProtocolError({
|
|
152
|
+
code: "MALFORMED_RESPONSE",
|
|
153
|
+
message: `CLI authority broker protocol mismatch at ${options.endpoint}`
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
if (response.ok) {
|
|
157
|
+
if (!response.result || typeof response.result !== "object") {
|
|
158
|
+
throw new CliAuthorityBrokerProtocolError({
|
|
159
|
+
code: "MALFORMED_RESPONSE",
|
|
160
|
+
message: `CLI authority broker protocol mismatch at ${options.endpoint}`
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
return response.result;
|
|
164
|
+
}
|
|
165
|
+
if (!response.error || typeof response.error !== "object" || typeof response.error.code !== "string" || typeof response.error.message !== "string") {
|
|
166
|
+
throw new CliAuthorityBrokerProtocolError({
|
|
167
|
+
code: "MALFORMED_RESPONSE",
|
|
168
|
+
message: `CLI authority broker protocol mismatch at ${options.endpoint}`
|
|
169
|
+
});
|
|
170
|
+
}
|
|
102
171
|
if (response.error.code === "BROKER_UNAVAILABLE") {
|
|
103
172
|
throw new CliAuthorityBrokerUnavailableError(options.endpoint, response.error);
|
|
104
173
|
}
|
|
105
174
|
throw new CliAuthorityBrokerProtocolError(response.error);
|
|
106
175
|
} catch (error) {
|
|
176
|
+
if (isCliAuthorityBrokerTimeoutError(error)) throw error;
|
|
107
177
|
if (isCliAuthorityBrokerUnavailableError(error)) throw error;
|
|
108
178
|
if (isCliAuthorityBrokerProtocolError(error)) throw error;
|
|
109
|
-
|
|
179
|
+
if (isBrokerUnavailableCause(error)) {
|
|
180
|
+
throw new CliAuthorityBrokerUnavailableError(options.endpoint, error);
|
|
181
|
+
}
|
|
182
|
+
throw error;
|
|
110
183
|
}
|
|
111
184
|
}
|
|
112
185
|
function createCliAuthorityBrokerClient(options) {
|
|
@@ -179,68 +252,10 @@ function createCliAuthorityBrokerClient(options) {
|
|
|
179
252
|
};
|
|
180
253
|
}
|
|
181
254
|
|
|
182
|
-
// packages/database-engine/cliAuthorityStoreDriver.ts
|
|
183
|
-
import path from "node:path";
|
|
184
|
-
function readCliAuthorityDriver(env) {
|
|
185
|
-
const value = env.NOLO_CLI_AUTHORITY_DRIVER?.trim();
|
|
186
|
-
if (value === "broker") {
|
|
187
|
-
return { driver: "broker", invalidDriver: null };
|
|
188
|
-
}
|
|
189
|
-
return {
|
|
190
|
-
driver: "broker",
|
|
191
|
-
invalidDriver: value ? value : null
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
function resolveCliAuthorityRunDir(options = {}) {
|
|
195
|
-
return path.join(resolveNoloHome({
|
|
196
|
-
...options,
|
|
197
|
-
env: options.env ?? process.env
|
|
198
|
-
}), "run");
|
|
199
|
-
}
|
|
200
|
-
function hashString(value) {
|
|
201
|
-
let hash = 0;
|
|
202
|
-
for (let index = 0; index < value.length; index += 1) {
|
|
203
|
-
hash = (hash << 5) - hash + value.charCodeAt(index) | 0;
|
|
204
|
-
}
|
|
205
|
-
return Math.abs(hash);
|
|
206
|
-
}
|
|
207
|
-
function resolveCliAuthorityBrokerPort(options = {}) {
|
|
208
|
-
const envPort = options.env?.NOLO_CLI_AUTHORITY_BROKER_PORT?.trim();
|
|
209
|
-
if (envPort) {
|
|
210
|
-
const port = Number(envPort);
|
|
211
|
-
if (Number.isInteger(port) && port > 0 && port < 65536) return port;
|
|
212
|
-
}
|
|
213
|
-
const noloHome = resolveNoloHome({
|
|
214
|
-
...options,
|
|
215
|
-
env: options.env ?? {}
|
|
216
|
-
});
|
|
217
|
-
return 47e3 + hashString(noloHome) % 2e3;
|
|
218
|
-
}
|
|
219
|
-
function resolveCliAuthorityStoreDriver(options = {}) {
|
|
220
|
-
return readCliAuthorityDriver(options.env ?? {}).driver;
|
|
221
|
-
}
|
|
222
|
-
function resolveCliAuthorityBrokerSocketPath(options) {
|
|
223
|
-
return path.join(resolveCliAuthorityRunDir(options), "authority-store-broker.sock");
|
|
224
|
-
}
|
|
225
|
-
function resolveCliAuthorityBrokerEndpoint(options) {
|
|
226
|
-
if (options.transport === "tcp") {
|
|
227
|
-
return `tcp://127.0.0.1:${resolveCliAuthorityBrokerPort(options)}`;
|
|
228
|
-
}
|
|
229
|
-
return `unix://${resolveCliAuthorityBrokerSocketPath(options)}`;
|
|
230
|
-
}
|
|
231
|
-
function resolveCliAuthorityBrokerMetadataPath(options) {
|
|
232
|
-
return path.join(resolveCliAuthorityRunDir(options), "authority-store-broker.json");
|
|
233
|
-
}
|
|
234
|
-
function resolveCliAuthorityBrokerHealthPath(options) {
|
|
235
|
-
return path.join(resolveCliAuthorityRunDir(options), "authority-store-broker.health.json");
|
|
236
|
-
}
|
|
237
|
-
|
|
238
255
|
export {
|
|
239
256
|
isCliAuthorityBrokerUnavailableError,
|
|
257
|
+
isCliAuthorityBrokerTimeoutError,
|
|
258
|
+
isCliAuthorityBrokerProtocolError,
|
|
240
259
|
createCliAuthorityBrokerSocketInvoker,
|
|
241
|
-
createCliAuthorityBrokerClient
|
|
242
|
-
resolveCliAuthorityStoreDriver,
|
|
243
|
-
resolveCliAuthorityBrokerEndpoint,
|
|
244
|
-
resolveCliAuthorityBrokerMetadataPath,
|
|
245
|
-
resolveCliAuthorityBrokerHealthPath
|
|
260
|
+
createCliAuthorityBrokerClient
|
|
246
261
|
};
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
toTimestampMs,
|
|
14
14
|
upsert,
|
|
15
15
|
write
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-DNNSCSA2.js";
|
|
17
17
|
import {
|
|
18
18
|
createUserKey,
|
|
19
19
|
createUserPreferenceKey,
|
|
@@ -24,20 +24,22 @@ import {
|
|
|
24
24
|
} from "./chunk-QSJ3HFEF.js";
|
|
25
25
|
import {
|
|
26
26
|
BUILTIN_NOLO_AGENT_KEY
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-L7B47JXR.js";
|
|
28
28
|
import {
|
|
29
29
|
asyncThunkCreator,
|
|
30
30
|
buildCreateSlice,
|
|
31
31
|
createAction,
|
|
32
32
|
createAsyncThunk,
|
|
33
|
-
createSelector
|
|
34
|
-
|
|
35
|
-
} from "./chunk-XOJRZUPF.js";
|
|
33
|
+
createSelector
|
|
34
|
+
} from "./chunk-KWSQR2KK.js";
|
|
36
35
|
import {
|
|
37
36
|
getAllServers,
|
|
38
37
|
getIsDesktopApp,
|
|
39
38
|
isProduction
|
|
40
39
|
} from "./chunk-QOKAKDPE.js";
|
|
40
|
+
import {
|
|
41
|
+
selectIdentityUserId
|
|
42
|
+
} from "./chunk-SEJ5OS6F.js";
|
|
41
43
|
import {
|
|
42
44
|
SERVERS
|
|
43
45
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P7OOB7QP.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-FHAGENAS.js";
|
|
8
8
|
import {
|
|
9
9
|
toSafeAgentSummary
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3BLB7QKO.js";
|
|
11
11
|
import {
|
|
12
12
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
13
13
|
isOwnedAgentKey,
|
|
@@ -77,12 +77,18 @@ function sortListedAgents(agents) {
|
|
|
77
77
|
});
|
|
78
78
|
return agents;
|
|
79
79
|
}
|
|
80
|
+
function readArgValue(args, flag) {
|
|
81
|
+
const index = args.indexOf(flag);
|
|
82
|
+
const value = index >= 0 ? args[index + 1] : void 0;
|
|
83
|
+
return value && !value.startsWith("--") ? value : void 0;
|
|
84
|
+
}
|
|
80
85
|
function parseAgentListArgs(args) {
|
|
81
86
|
return {
|
|
82
87
|
wantJson: args.includes("--json"),
|
|
83
88
|
wantSafe: args.includes("--safe"),
|
|
84
89
|
publicOnly: args.includes("--public-only"),
|
|
85
90
|
idsOnly: args.includes("--ids-only"),
|
|
91
|
+
scope: readArgValue(args, "--scope"),
|
|
86
92
|
showUnavailable: args.includes("--show-unavailable"),
|
|
87
93
|
// --safe 默认输出精简投影(与 server listAgents 一致,防大列表被截断);
|
|
88
94
|
// --verbose 拿回完整字段集排障。
|
|
@@ -118,6 +124,17 @@ async function hasReadableRecord(args) {
|
|
|
118
124
|
return false;
|
|
119
125
|
}
|
|
120
126
|
}
|
|
127
|
+
async function listRemotePublicAgents(args) {
|
|
128
|
+
const response = await args.fetchImpl(`${args.serverUrl}/rpc/getPublicAgents`, {
|
|
129
|
+
method: "POST",
|
|
130
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${args.authToken}` },
|
|
131
|
+
body: JSON.stringify({ limit: Math.min(args.limit ?? 500, 500), summary: true })
|
|
132
|
+
});
|
|
133
|
+
if (!response.ok) throw new Error(`Public agent catalog request failed (${response.status})`);
|
|
134
|
+
const payload = await response.json();
|
|
135
|
+
const records = Array.isArray(payload?.data?.data) ? payload.data.data : Array.isArray(payload?.data) ? payload.data : [];
|
|
136
|
+
return records.filter((record) => record?.isPublic === true).map((record) => normalizeListedAgent({ ...record, userId: record?.userId || "system" })).filter((agent) => agent != null).map((agent) => ({ ...agent, publicRecordExists: true }));
|
|
137
|
+
}
|
|
121
138
|
async function listRemoteAgents(args) {
|
|
122
139
|
const recordGroups = [await args.queryUserRecords({ ...args, type: "agent" })];
|
|
123
140
|
const agents = sortListedAgents(
|
|
@@ -214,6 +231,7 @@ export {
|
|
|
214
231
|
toSafeListedAgentSummary,
|
|
215
232
|
parseAgentListArgs,
|
|
216
233
|
listLocalCachedAgents,
|
|
234
|
+
listRemotePublicAgents,
|
|
217
235
|
listRemoteAgents,
|
|
218
236
|
listRemoteAgentsAcrossServers,
|
|
219
237
|
listFavoriteAgentIdsAcrossServers,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
findModelConfig,
|
|
3
3
|
getProviderByModelName
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MMZ6ZTVO.js";
|
|
5
5
|
import {
|
|
6
6
|
asOptionalFiniteNumber
|
|
7
7
|
} from "./chunk-WWC7I6TA.js";
|
|
@@ -207,9 +207,7 @@ function resolveAgentRuntimeConfigFromRecord(key, record) {
|
|
|
207
207
|
}
|
|
208
208
|
|
|
209
209
|
// packages/ai/agent/toolOutputPolicy.ts
|
|
210
|
-
var MAX_HISTORICAL_TOOL_CONTENT_CHARS = 1600;
|
|
211
210
|
var MAX_IN_TURN_TOOL_CONTENT_CHARS = 4e3;
|
|
212
|
-
var FRESH_TOOL_OUTPUT_MAX_CHARS = 32e3;
|
|
213
211
|
var DEFAULT_TOOL_OUTPUT_PROFILE = {
|
|
214
212
|
maxChars: MAX_IN_TURN_TOOL_CONTENT_CHARS,
|
|
215
213
|
headRatio: 0.5
|
|
@@ -234,21 +232,16 @@ function resolveHistoricalToolContentCap(toolName, historicalMaxChars) {
|
|
|
234
232
|
return profile?.historicalMaxChars !== void 0 ? Math.max(historicalMaxChars, profile.historicalMaxChars) : historicalMaxChars;
|
|
235
233
|
}
|
|
236
234
|
function projectToolMessageContent(input) {
|
|
237
|
-
const { content,
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
235
|
+
const { content, toolName } = input;
|
|
236
|
+
const maxChars = resolveToolOutputProfile(toolName).maxChars;
|
|
237
|
+
if (content.length <= maxChars) return content;
|
|
238
|
+
return clipToolText(
|
|
239
|
+
content,
|
|
240
|
+
maxChars,
|
|
241
|
+
resolveToolOutputProfile(toolName).headRatio,
|
|
242
|
+
`
|
|
245
243
|
\u2026[\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${content.length} \u5B57\u7B26]`
|
|
246
|
-
|
|
247
|
-
}
|
|
248
|
-
const cap = resolveHistoricalToolContentCap(toolName, historicalMaxChars);
|
|
249
|
-
if (content.length <= cap) return content;
|
|
250
|
-
return content.slice(0, cap) + `
|
|
251
|
-
\u2026[\u622A\u65AD\uFF0C\u539F\u59CB\u957F\u5EA6 ${content.length} \u5B57\u7B26]`;
|
|
244
|
+
);
|
|
252
245
|
}
|
|
253
246
|
function clipToolText(content, maxChars, headRatio, marker = "\n\n[... tool output middle omitted; head/tail preserved ...]\n\n") {
|
|
254
247
|
const normalized = content.replace(/\r\n/g, "\n").trim();
|
|
@@ -543,8 +536,6 @@ export {
|
|
|
543
536
|
hasImageInRuntimeMessages,
|
|
544
537
|
stripImagePartsFromMessages,
|
|
545
538
|
stripImagePartsForTextOnlyAgent,
|
|
546
|
-
MAX_HISTORICAL_TOOL_CONTENT_CHARS,
|
|
547
|
-
FRESH_TOOL_OUTPUT_MAX_CHARS,
|
|
548
539
|
resolveToolOutputProfile,
|
|
549
540
|
resolveHistoricalToolContentCap,
|
|
550
541
|
projectToolMessageContent,
|
|
@@ -8,6 +8,19 @@ import {
|
|
|
8
8
|
asOptionalTrimmedString
|
|
9
9
|
} from "./chunk-G3SUCT4W.js";
|
|
10
10
|
|
|
11
|
+
// packages/core/ollamaEndpoint.ts
|
|
12
|
+
function isOllamaEndpoint(endpoint) {
|
|
13
|
+
if (!endpoint || typeof endpoint !== "string") return false;
|
|
14
|
+
try {
|
|
15
|
+
const url = new URL(endpoint.includes("://") ? endpoint : `http://${endpoint}`);
|
|
16
|
+
if (url.port === "11434") return true;
|
|
17
|
+
const host = url.hostname.toLowerCase();
|
|
18
|
+
return host === "ollama.com" || host.endsWith(".ollama.com") || host === "ollama.ai" || host.endsWith(".ollama.ai");
|
|
19
|
+
} catch {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
11
24
|
// packages/ai/llm/usageRequestOptions.ts
|
|
12
25
|
var STREAM_USAGE_PROVIDERS = /* @__PURE__ */ new Set([
|
|
13
26
|
"google",
|
|
@@ -56,7 +69,7 @@ var normalizeProviderName = (providerName) => asTrimmedLowercaseString(providerN
|
|
|
56
69
|
var getUsageRequestOptions = (providerName, options) => {
|
|
57
70
|
const normalizedProvider = normalizeProviderName(providerName);
|
|
58
71
|
const api = options?.api ?? "chat-completions";
|
|
59
|
-
const shouldRequestStreamUsage = STREAM_USAGE_PROVIDERS.has(normalizedProvider) || normalizedProvider === "custom" && isKimiCodeEndpoint(options?.endpoint);
|
|
72
|
+
const shouldRequestStreamUsage = STREAM_USAGE_PROVIDERS.has(normalizedProvider) || normalizedProvider === "custom" && (isKimiCodeEndpoint(options?.endpoint) || isOllamaEndpoint(options?.endpoint));
|
|
60
73
|
if (api === "responses") {
|
|
61
74
|
return EXTRA_USAGE_FIELD_PROVIDERS.has(normalizedProvider) ? {
|
|
62
75
|
usage: {
|
|
@@ -108,7 +121,7 @@ function shouldStripReasoningContentForOutbound(provider, model) {
|
|
|
108
121
|
const m = model?.trim().toLowerCase();
|
|
109
122
|
if (!p || !m) return false;
|
|
110
123
|
if (p === "deepseek" || p === "nolo") {
|
|
111
|
-
return m === "deepseek-v4-flash" || m === "deepseek-v4-flash-vision-exp" || m === "deepseek-v4-pro";
|
|
124
|
+
return m === "deepseek-flash" || m === "deepseek-v4-flash" || m === "deepseek-v4-flash-vision-exp" || m === "deepseek-v4-pro";
|
|
112
125
|
}
|
|
113
126
|
return false;
|
|
114
127
|
}
|
|
@@ -329,6 +342,33 @@ var extractToolCallsFromResponseOutput = (response) => {
|
|
|
329
342
|
return calls;
|
|
330
343
|
};
|
|
331
344
|
|
|
345
|
+
// packages/agent-runtime/promptCacheKey.ts
|
|
346
|
+
function collectStablePromptPrefix(messages, fallbackPrompt) {
|
|
347
|
+
const systemTexts = [];
|
|
348
|
+
if (fallbackPrompt?.trim()) systemTexts.push(fallbackPrompt.trim());
|
|
349
|
+
for (const raw of messages) {
|
|
350
|
+
if (!raw || typeof raw !== "object") continue;
|
|
351
|
+
const message = raw;
|
|
352
|
+
const role = String(message.role ?? "");
|
|
353
|
+
if (role !== "system" && role !== "developer") continue;
|
|
354
|
+
if (typeof message.content === "string") {
|
|
355
|
+
const boundary = Number(message.stable_prefix_chars);
|
|
356
|
+
const text = Number.isFinite(boundary) && boundary > 0 ? message.content.slice(0, boundary) : message.content;
|
|
357
|
+
if (text.trim()) systemTexts.push(text.trim());
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
return systemTexts.join("\n\n");
|
|
361
|
+
}
|
|
362
|
+
function stablePromptCacheKey(parts, namespace) {
|
|
363
|
+
const value = JSON.stringify(parts);
|
|
364
|
+
let hash = 2166136261;
|
|
365
|
+
for (let index = 0; index < value.length; index += 1) {
|
|
366
|
+
hash ^= value.charCodeAt(index);
|
|
367
|
+
hash = Math.imul(hash, 16777619) >>> 0;
|
|
368
|
+
}
|
|
369
|
+
return `${namespace}-${hash.toString(16).padStart(8, "0")}`;
|
|
370
|
+
}
|
|
371
|
+
|
|
332
372
|
// packages/core/chat/imageParts.ts
|
|
333
373
|
function isImageUrlPart(part) {
|
|
334
374
|
return isRecord(part) && part.type === "image_url";
|
|
@@ -340,6 +380,7 @@ function hasImageParts(messages) {
|
|
|
340
380
|
}
|
|
341
381
|
|
|
342
382
|
export {
|
|
383
|
+
isOllamaEndpoint,
|
|
343
384
|
getUsageRequestOptions,
|
|
344
385
|
isImageUrlPart,
|
|
345
386
|
hasImageParts,
|
|
@@ -351,5 +392,7 @@ export {
|
|
|
351
392
|
extractTextFromResponseOutput,
|
|
352
393
|
extractReasoningFromResponseOutput,
|
|
353
394
|
extractImagePartsFromResponseOutput,
|
|
354
|
-
extractToolCallsFromResponseOutput
|
|
395
|
+
extractToolCallsFromResponseOutput,
|
|
396
|
+
collectStablePromptPrefix,
|
|
397
|
+
stablePromptCacheKey
|
|
355
398
|
};
|
|
@@ -1,15 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
estimateTokenCount
|
|
3
|
+
} from "./chunk-PSCNXBYA.js";
|
|
1
4
|
import {
|
|
2
5
|
compactWhitespace
|
|
3
6
|
} from "./chunk-DWLEOOGR.js";
|
|
4
7
|
import {
|
|
5
8
|
addContentAction
|
|
6
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-RVWRKFUB.js";
|
|
7
10
|
import {
|
|
8
11
|
upload
|
|
9
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-DNNSCSA2.js";
|
|
10
13
|
import {
|
|
11
14
|
getRuntimeServerContext
|
|
12
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-KWSQR2KK.js";
|
|
13
16
|
import {
|
|
14
17
|
API_ENDPOINTS
|
|
15
18
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -17,14 +20,6 @@ import {
|
|
|
17
20
|
normalizeServerOrigin
|
|
18
21
|
} from "./chunk-CF7PE763.js";
|
|
19
22
|
|
|
20
|
-
// packages/ai/context/tokenUtils.ts
|
|
21
|
-
var estimateTokenCount = (text) => {
|
|
22
|
-
if (!text) return 0;
|
|
23
|
-
const chineseChars = (text.match(/[\u4e00-\u9fa5\u3400-\u4dbf]/g) || []).length;
|
|
24
|
-
const otherChars = text.length - chineseChars;
|
|
25
|
-
return Math.ceil(chineseChars * 1.5 + otherChars * 0.25);
|
|
26
|
-
};
|
|
27
|
-
|
|
28
23
|
// packages/core/chat/messageContentSerialize.ts
|
|
29
24
|
var serializeMessageContent = (content, imagePlaceholder = "[\u56FE\u7247]") => {
|
|
30
25
|
if (typeof content === "string") {
|
|
@@ -708,9 +703,78 @@ function clipCompactText(value, max, ellipsis = "...") {
|
|
|
708
703
|
return `${compact.slice(0, max - ellipsis.length)}${ellipsis}`;
|
|
709
704
|
}
|
|
710
705
|
|
|
706
|
+
// packages/ai/token/providerCallTiming.ts
|
|
707
|
+
var defaultNow = () => {
|
|
708
|
+
const perf = globalThis.performance;
|
|
709
|
+
return typeof perf?.now === "function" ? perf.now() : Date.now();
|
|
710
|
+
};
|
|
711
|
+
var normalizeTimingMs = (value) => {
|
|
712
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value < 0) {
|
|
713
|
+
return void 0;
|
|
714
|
+
}
|
|
715
|
+
return Math.round(value);
|
|
716
|
+
};
|
|
717
|
+
var createProviderCallTimingTracker = (now = defaultNow) => ({
|
|
718
|
+
startMonotonicMs: now(),
|
|
719
|
+
now
|
|
720
|
+
});
|
|
721
|
+
var observeMeaningfulProviderResponseAt = (tracker, observedAt) => {
|
|
722
|
+
if (!tracker || tracker.firstMeaningfulMonotonicMs !== void 0) return;
|
|
723
|
+
tracker.firstMeaningfulMonotonicMs = observedAt;
|
|
724
|
+
};
|
|
725
|
+
var observeMeaningfulProviderResponse = (tracker) => {
|
|
726
|
+
if (!tracker) return;
|
|
727
|
+
observeMeaningfulProviderResponseAt(tracker, tracker.now());
|
|
728
|
+
};
|
|
729
|
+
var finalizeProviderCallTiming = (tracker) => {
|
|
730
|
+
if (!tracker) return {};
|
|
731
|
+
const callDurationMs = normalizeTimingMs(
|
|
732
|
+
Math.max(0, tracker.now() - tracker.startMonotonicMs)
|
|
733
|
+
);
|
|
734
|
+
const firstOutputMs = tracker.firstMeaningfulMonotonicMs !== void 0 ? normalizeTimingMs(
|
|
735
|
+
Math.max(0, tracker.firstMeaningfulMonotonicMs - tracker.startMonotonicMs)
|
|
736
|
+
) : void 0;
|
|
737
|
+
return {
|
|
738
|
+
...firstOutputMs !== void 0 ? { firstOutputMs } : {},
|
|
739
|
+
...callDurationMs !== void 0 ? { callDurationMs } : {}
|
|
740
|
+
};
|
|
741
|
+
};
|
|
742
|
+
var withProviderCallTimingFields = (usage, timing) => {
|
|
743
|
+
if (!usage || typeof usage !== "object") return usage;
|
|
744
|
+
return {
|
|
745
|
+
...usage,
|
|
746
|
+
...timing.firstOutputMs !== void 0 ? { firstOutputMs: timing.firstOutputMs } : {},
|
|
747
|
+
...timing.callDurationMs !== void 0 ? { callDurationMs: timing.callDurationMs } : {}
|
|
748
|
+
};
|
|
749
|
+
};
|
|
750
|
+
var isMeaningfulChatCompletionOutput = (delta) => {
|
|
751
|
+
if (!delta || typeof delta !== "object") return false;
|
|
752
|
+
const d = delta;
|
|
753
|
+
if (typeof d.content === "string" && d.content) return true;
|
|
754
|
+
if (typeof d.reasoning_content === "string" && d.reasoning_content) return true;
|
|
755
|
+
if (typeof d.reasoning === "string" && d.reasoning) return true;
|
|
756
|
+
return Array.isArray(d.tool_calls) && d.tool_calls.length > 0;
|
|
757
|
+
};
|
|
758
|
+
var isMeaningfulResponsesOutput = (event) => {
|
|
759
|
+
if (!event || typeof event !== "object") return false;
|
|
760
|
+
const e = event;
|
|
761
|
+
const type = typeof e.type === "string" ? e.type : "";
|
|
762
|
+
if (type.startsWith("response.") && type.endsWith(".delta")) {
|
|
763
|
+
const delta = e.delta;
|
|
764
|
+
if (typeof delta === "string" && delta.length > 0) return true;
|
|
765
|
+
if (delta && typeof delta === "object" && typeof delta.text === "string" && delta.text) {
|
|
766
|
+
return true;
|
|
767
|
+
}
|
|
768
|
+
return false;
|
|
769
|
+
}
|
|
770
|
+
if (type === "response.output_item.added" || type === "response.output_item.done") {
|
|
771
|
+
return e.item?.type === "function_call";
|
|
772
|
+
}
|
|
773
|
+
return false;
|
|
774
|
+
};
|
|
775
|
+
|
|
711
776
|
export {
|
|
712
777
|
clipCompactText,
|
|
713
|
-
estimateTokenCount,
|
|
714
778
|
planContextUsage,
|
|
715
779
|
buildDatabaseFileContentUrl,
|
|
716
780
|
serializeMessageContent,
|
|
@@ -723,5 +787,13 @@ export {
|
|
|
723
787
|
formatFileOperationsFromMessages,
|
|
724
788
|
formatMessagesForSummaryWithTruncation,
|
|
725
789
|
buildCompactionMetricsFromPlan,
|
|
726
|
-
formatCompactionMetricsLog
|
|
790
|
+
formatCompactionMetricsLog,
|
|
791
|
+
normalizeTimingMs,
|
|
792
|
+
createProviderCallTimingTracker,
|
|
793
|
+
observeMeaningfulProviderResponseAt,
|
|
794
|
+
observeMeaningfulProviderResponse,
|
|
795
|
+
finalizeProviderCallTiming,
|
|
796
|
+
withProviderCallTimingFields,
|
|
797
|
+
isMeaningfulChatCompletionOutput,
|
|
798
|
+
isMeaningfulResponsesOutput
|
|
727
799
|
};
|
|
@@ -77,7 +77,11 @@ var TOOL_PACKS = {
|
|
|
77
77
|
"globFiles",
|
|
78
78
|
"execShell",
|
|
79
79
|
"launchProcess",
|
|
80
|
-
"listProcesses"
|
|
80
|
+
"listProcesses",
|
|
81
|
+
"taskWait",
|
|
82
|
+
"taskLogs",
|
|
83
|
+
"taskStop",
|
|
84
|
+
"tasks"
|
|
81
85
|
],
|
|
82
86
|
// 表格读写。唯一真相源——app-builder 能力包与 table object skill 都从这里取,
|
|
83
87
|
// 以前两边各抄一份,改一个忘另一个就会静默不同步。
|
|
@@ -267,7 +271,7 @@ function resolveEffectiveEnabledPacks(args) {
|
|
|
267
271
|
...base,
|
|
268
272
|
...base.length === 0 ? args.emptyFallbackPacks ?? [] : [],
|
|
269
273
|
...args.hostPacks ?? [],
|
|
270
|
-
...ALWAYS_ON_PACK_IDS
|
|
274
|
+
...args.includeAlwaysOnPacks === false ? [] : ALWAYS_ON_PACK_IDS
|
|
271
275
|
])
|
|
272
276
|
];
|
|
273
277
|
}
|
|
@@ -17,8 +17,8 @@ import {
|
|
|
17
17
|
compileCodingEffectiveTools,
|
|
18
18
|
resolveCodingBuiltinSlug,
|
|
19
19
|
resolveCodingEffectiveTools
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
} from "./chunk-DZZL7UBV.js";
|
|
21
|
+
import "./chunk-ZRSJ3JEH.js";
|
|
22
22
|
import "./chunk-EY7V7REW.js";
|
|
23
23
|
import "./chunk-O6OSWFZQ.js";
|
|
24
24
|
import "./chunk-UZ6XXCVR.js";
|