nolo-cli 0.84.0-alpha.1 → 0.84.0
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 +2 -2
- package/{_executeModel-IULR47HG.js → _executeModel-BPUR2QYH.js} +51 -50
- package/{action-D22U6CTH.js → action-P4TNFGAD.js} +11 -11
- package/{addContentAction-XAPUTGL4.js → addContentAction-MB2HHMDZ.js} +9 -9
- package/{addDialogAgentAction-M7VLLBZM.js → addDialogAgentAction-S2NRBCWW.js} +9 -9
- package/{agentDeleteCommand-2S4WCDQC.js → agentDeleteCommand-MNAA6MIG.js} +32 -30
- package/{agentEmailCommands-V3ADGHX7.js → agentEmailCommands-SK34WJKU.js} +70 -66
- package/{agentGrantCommands-R3VQEZJR.js → agentGrantCommands-M3XFO6EN.js} +2 -2
- package/{agentListCommands-EPK3S274.js → agentListCommands-I26MKI4T.js} +55 -36
- package/{agentMachineCommands-XMZWK7P3.js → agentMachineCommands-M6QDR6P3.js} +32 -30
- package/{agentProviderCommands-65ZC2WB4.js → agentProviderCommands-X3UNW77C.js} +87 -0
- package/{agentPullCommand-N7L2CT7L.js → agentPullCommand-O5MPVJ5E.js} +3 -3
- package/agentRecordCommands-HTHLO2MM.js +129 -0
- package/{agentRunCommand-VUWNWC7C.js → agentRunCommand-IAIRCMTH.js} +70 -65
- package/{agentRunControl-T44MESII.js → agentRunControl-AVJR4JW4.js} +2 -2
- package/{agentRuntimeLocal-YRONTDLM.js → agentRuntimeLocal-3WTYYIT2.js} +32 -26
- package/{agentSlice-2P7OJFES.js → agentSlice-TVP3HINW.js} +10 -10
- package/{appDeleteCommands-YS7UGMP3.js → appDeleteCommands-SB5TNLKY.js} +32 -30
- package/{appDeployCommands-XIE5Z4BE.js → appDeployCommands-2IPKZINV.js} +32 -30
- package/{appDeployStatusCommands-54UDVYET.js → appDeployStatusCommands-K63TFUID.js} +32 -30
- package/{appGetCommands-6XYLBCRN.js → appGetCommands-VU2SLNEH.js} +32 -30
- package/{appListCommands-VEGH7SF5.js → appListCommands-S3T4DJ36.js} +32 -30
- package/{authCommand-JIEOFHXW.js → authCommand-HGP2XTKC.js} +185 -28
- package/{authCommands-ILTBI6JV.js → authCommands-RGOGCPP6.js} +4 -5
- package/builtinSkillRegistry-Q2VVY3SC.js +33 -0
- package/{chatQueueReduxAdapter-GPYCH5Z2.js → chatQueueReduxAdapter-TWIYKVIZ.js} +25 -25
- package/{chromeCommands-VOIRNJBL.js → chromeCommands-FZYAU75D.js} +1 -1
- package/{chromeOpsCommands-M7DPCX2T.js → chromeOpsCommands-62P2Q2YB.js} +31 -1
- package/{chunk-C3FZR5EC.js → chunk-2F7RJC6L.js} +1 -1
- package/{chunk-BOYUESO7.js → chunk-3AMA42ZI.js} +1 -1
- package/{chunk-RZOJRTKR.js → chunk-3BGIKIPF.js} +444 -920
- package/{chunk-HQUORJTM.js → chunk-3BMYXEUW.js} +1 -1
- package/{chunk-EBKMQULC.js → chunk-3IUWIAHP.js} +13 -15
- package/{chunk-NTW5GWDM.js → chunk-3VNWWVKB.js} +2 -0
- package/{chunk-4SZ37KLL.js → chunk-3VUWPRFW.js} +50 -30
- package/{chunk-WL2RKIBF.js → chunk-3YIAR5UI.js} +1 -1
- package/{chunk-DWUCB2A3.js → chunk-42V6BK2E.js} +1 -1
- package/{chunk-AX7RMXSH.js → chunk-4MK3I7Y4.js} +38 -4
- package/{chunk-PF6O3GR3.js → chunk-52Q2IW2X.js} +1340 -1273
- package/{chunk-Y3NZYLPG.js → chunk-5MEYHVIB.js} +1 -1
- package/{chunk-5XTOKQLW.js → chunk-5UTFL4QJ.js} +6 -2
- package/chunk-5ZUL4CUO.js +10 -0
- package/{chunk-6YTOJY35.js → chunk-6D2JFXLY.js} +35 -0
- package/{chunk-E6RGHPDR.js → chunk-6D6VBVEW.js} +4 -6
- package/{chunk-FZGV4FGK.js → chunk-6GFOD3TK.js} +260 -140
- package/{chunk-TMPLPCVX.js → chunk-6OZ36FXI.js} +2 -2
- package/{chunk-PZM3EENV.js → chunk-6Z7MY3V7.js} +1 -1
- package/{chunk-BYEJ7K2Z.js → chunk-7S4YWN7P.js} +1 -1
- package/{chunk-SREASRV5.js → chunk-ABQYVJBJ.js} +1 -1
- package/chunk-ACTMNVHM.js +93 -0
- package/{chunk-ZZCJUXUI.js → chunk-AHAHBQMU.js} +2 -2
- package/{chunk-BJCWNHVU.js → chunk-BFDFRLLQ.js} +2 -2
- package/chunk-BMQ2MJUK.js +153 -0
- package/chunk-BNGW5ASC.js +344 -0
- package/{chunk-2KDR4CWE.js → chunk-BYMV6QZG.js} +24 -1
- package/{chunk-73BR2IQT.js → chunk-CWQINZEA.js} +127 -7
- package/{chunk-HTMVBPOF.js → chunk-DD6XE56O.js} +19 -72
- package/{chunk-CADAR6QU.js → chunk-EYAQT56M.js} +4 -3
- package/{chunk-CJCJF5XB.js → chunk-FDTR4QJ6.js} +4 -2
- package/{chunk-D6XYLSOS.js → chunk-FKNWP6SG.js} +1 -1
- package/{chunk-3VPDELAP.js → chunk-FP76KI2Y.js} +1500 -84
- package/chunk-FV3JEYR3.js +870 -0
- package/{chunk-GCJ3IS5M.js → chunk-GIVFXPWK.js} +177 -6
- package/chunk-GMZLP5DV.js +82 -0
- package/{chunk-LHDV2QUI.js → chunk-GNCCNNZD.js} +4 -2
- package/{chunk-XWNRAIUL.js → chunk-GP5LKBUZ.js} +6 -16
- package/{chunk-PZCTYKGU.js → chunk-GQBOR3G6.js} +2 -2
- package/{chunk-NFT2AOK5.js → chunk-H4AHY5BU.js} +13 -85
- package/{chunk-FNGAF7C4.js → chunk-HAFJ3NDE.js} +137 -12
- package/{chunk-ZVN6I33J.js → chunk-HCT7U36O.js} +9 -5
- package/{chunk-7QVPPOEC.js → chunk-HKNXJGEC.js} +43 -43
- package/{chunk-3JQ2NRYU.js → chunk-HVURBGF3.js} +4 -4
- package/{chunk-OZX2IPKM.js → chunk-HYJFRTLW.js} +2 -2
- package/{chunk-HH65VA5U.js → chunk-I3TQJXQ7.js} +109 -6
- package/{chunk-UDQWGU7F.js → chunk-J4MOO56S.js} +1 -1
- package/{chunk-KC5FAHVS.js → chunk-JEDZAO7L.js} +1 -1
- package/{chunk-6XIE5ZGI.js → chunk-JPGCXHNM.js} +1 -1
- package/{chunk-DUJWWUGV.js → chunk-K36IXSCQ.js} +1 -1
- package/{chunk-KRMWO2NN.js → chunk-KAUSRTO6.js} +3 -3
- package/{chunk-7FWPLK4M.js → chunk-LJ5VW2UJ.js} +1 -1
- package/{chunk-GHEJJGJI.js → chunk-LMREEBWT.js} +833 -109
- package/{chunk-RXX4GDIH.js → chunk-LS2ZANRJ.js} +1 -1
- package/chunk-LVIFM7VW.js +1625 -0
- package/{chunk-BJIRLHJR.js → chunk-M2EJHDJP.js} +4 -0
- package/{chunk-EVBFYPDC.js → chunk-MC4XLIJ7.js} +6 -2
- package/{chunk-KEZNSFGD.js → chunk-MZYBSTMH.js} +11 -173
- package/chunk-OCZKATRC.js +129 -0
- package/{chunk-MXUSPS2N.js → chunk-OIVSQH2O.js} +1510 -1592
- package/{chunk-E36HZARC.js → chunk-P5EVSOPA.js} +93 -17
- package/{chunk-SZLVDREM.js → chunk-PBA4UJBK.js} +3 -3
- package/{chunk-URWDSZRW.js → chunk-PMAIQX7A.js} +3 -3
- package/{chunk-AETZ7AD6.js → chunk-Q554LLSI.js} +1 -1
- package/{chunk-AJHEFRGJ.js → chunk-Q67DOFOO.js} +214 -5
- package/{chunk-UZ6XXCVR.js → chunk-QDSINZM3.js} +15 -2
- package/{chunk-NRALD3CC.js → chunk-QSHEEA5N.js} +54 -10
- package/chunk-QU7KDSZX.js +677 -0
- package/{chunk-T25L377S.js → chunk-RPJUFEGR.js} +10 -10
- package/{chunk-QCZX4FTW.js → chunk-SH43IESU.js} +173 -15
- package/{chunk-SPAQ4PVV.js → chunk-SV5IJK6K.js} +1 -1
- package/{chunk-BKJO7LDP.js → chunk-U4OKDZFH.js} +6 -6
- package/{chunk-DM4FBSWG.js → chunk-UDVH2P4A.js} +7 -7
- package/{chunk-4EJ5QYB5.js → chunk-UEVXFHQB.js} +2 -2
- package/{chunk-JYYZCK2Z.js → chunk-V7E4PXQD.js} +1 -1
- package/{chunk-NHRQCXIQ.js → chunk-VMFTFOWF.js} +13 -3
- package/{chunk-YFADVSZE.js → chunk-VRTTFDBM.js} +7 -6
- package/{chunk-U7YP7ECK.js → chunk-WP5UXDA5.js} +84 -13
- package/{chunk-5J7W2VWW.js → chunk-WV42OMV7.js} +6 -265
- package/{chunk-3QPYFHAH.js → chunk-XD2MJFUG.js} +1 -1
- package/{chunk-IDGYOD2O.js → chunk-XP3VVAPG.js} +3174 -223
- package/{chunk-ETLZZQJE.js → chunk-Z2PV6O2T.js} +121 -26
- package/{chunk-BZNGCVAW.js → chunk-Z5625XML.js} +4 -4
- package/{contentThunks-THSCADSK.js → contentThunks-JYWI7G7I.js} +26 -26
- package/{cooldownCommands-BSCH2W7P.js → cooldownCommands-REAWYVTY.js} +2 -2
- package/{createAgentAutomationAction-WGN3UQ5A.js → createAgentAutomationAction-Z4SUJ54Y.js} +26 -26
- package/{createDialogAction-3EN2NLH7.js → createDialogAction-RCHFLVJ2.js} +29 -29
- package/{createPageAction-4VK473QV.js → createPageAction-YK2253XQ.js} +28 -28
- package/{dbSlice-GKGGFNOB.js → dbSlice-A6C6H32X.js} +8 -8
- package/{deleteFile-LWSR674W.js → deleteFile-YG6QMJLU.js} +3 -3
- package/{dialogCommands-PS4NWYY7.js → dialogCommands-X4UOZQWX.js} +36 -32
- package/{dialogSlice-CLV7SVOZ.js → dialogSlice-IVTWLCE2.js} +31 -25
- package/{docCreateCommands-4KANZJR6.js → docCreateCommands-VD6TGHG4.js} +33 -31
- package/{docDeleteCommands-F2S2TRUF.js → docDeleteCommands-OT3R2G4W.js} +34 -32
- package/{docReadCommands-B2WDPZQE.js → docReadCommands-2G7BIXSH.js} +33 -31
- package/{docStore-TDLCHWPF.js → docStore-UENKCCDX.js} +9 -9
- package/{docUpdateCommands-E7TKHRIO.js → docUpdateCommands-45MVJKZA.js} +33 -31
- package/{fetchMessages-DRABNDPZ.js → fetchMessages-EIU7UFFK.js} +3 -4
- package/{getPricing-QVTUQQTM.js → getPricing-LUSEABA6.js} +4 -4
- package/{handleSendMessageAction-AHL3ZHE4.js → handleSendMessageAction-LM2J4HC3.js} +66 -74
- package/index.js +99 -86
- package/{localDialogRead-PUQKFI73.js → localDialogRead-BTFJ4V2I.js} +2 -2
- package/{localRuntimeDb-P37ZTX55.js → localRuntimeDb-SYQGUF4U.js} +1 -1
- package/{machineCommands-OTABVXOA.js → machineCommands-6N6MQIE6.js} +69 -65
- package/{machineWsRunDispatch-V4EVQSMZ.js → machineWsRunDispatch-7MFKVQCR.js} +65 -61
- package/{memberThunks-KATHH3F4.js → memberThunks-P2ECUJ56.js} +9 -9
- package/{models-GS72DVJS.js → models-T3SG6MJ5.js} +2 -2
- package/{offlineMarxistsAgentCommand-GEH6SNNA.js → offlineMarxistsAgentCommand-HGXZV4XJ.js} +1 -1
- package/package.json +1 -1
- package/pdf-U6KSUEZZ.js +26435 -0
- package/providerPresetApply-XI3WUPTI.js +214 -0
- package/providerRegistry-KEPWWGXD.js +31 -0
- package/{read-LC6HVYBN.js → read-COE3ZYR6.js} +5 -4
- package/{readDocTool-N3ERJHHF.js → readDocTool-5USN4A6V.js} +1 -1
- package/{readlineWorkspace-IIT3FQ6I.js → readlineWorkspace-JWBON5CX.js} +291 -135
- package/{removeDialogAgentAction-F5GPTALR.js → removeDialogAgentAction-W66BJ7CF.js} +12 -12
- package/{runAgentClientLoop-7TQM7IAR.js → runAgentClientLoop-TA4SSPHE.js} +49 -49
- package/{runtimeDoctorCommands-CROTMULY.js → runtimeDoctorCommands-X6WDBEQX.js} +2 -2
- package/{setDialogExtraReferencesAction-AY4ZCF3A.js → setDialogExtraReferencesAction-2ALKG3WA.js} +10 -10
- package/{setPrimaryDialogAgentAction-HPMG7V3R.js → setPrimaryDialogAgentAction-TQZB55F6.js} +12 -12
- package/{settingSlice-OEJA4NQO.js → settingSlice-P4ZW7K5X.js} +10 -10
- package/{spaceCommands-FSYH7AL4.js → spaceCommands-6NSAXB7D.js} +31 -29
- package/{streamAgentChatTurn-6EF6TVFK.js → streamAgentChatTurn-X5ENGUIS.js} +126 -65
- package/{switchDialogAgentAction-HMDZTZ4I.js → switchDialogAgentAction-3KI72HHS.js} +9 -9
- package/{tableCommands-SUNTHAYX.js → tableCommands-O6NWHFKV.js} +1 -1
- package/{toolApiClient-VGYUB4P5.js → toolApiClient-G3M73RTB.js} +3 -3
- package/{tools-R3QNWWTD.js → tools-XRQR7ZZR.js} +45 -45
- package/tuiSummaryLlmCaller-UFGFOIIW.js +128 -0
- package/{updateCommands-Y363MC3L.js → updateCommands-2M74UL7P.js} +2 -2
- package/{updateDialogTitleAction-F3EUOWOB.js → updateDialogTitleAction-ESUUD3GT.js} +46 -29
- package/agentRecordCommands-WFPWLWOF.js +0 -125
- package/chunk-FMODTASJ.js +0 -109
- package/chunk-I42VC5KR.js +0 -15
- package/chunk-NB5SIWC4.js +0 -611
- package/chunk-NG4UT4K4.js +0 -79
- package/codingSkills-7S6523WH.js +0 -48
- package/tuiSummaryLlmCaller-PWOXTCBF.js +0 -116
- package/{chunk-3RAG2NAD.js → chunk-UKWGR5SS.js} +3 -3
- package/{db-VQSAOWAO.js → db-WK5MDZVN.js} +1 -1
- package/{localRuntimeAuthority-R5UBODT3.js → localRuntimeAuthority-6IR6BBXE.js} +3 -3
|
@@ -7,10 +7,10 @@ import {
|
|
|
7
7
|
listUserRecordsFromServers,
|
|
8
8
|
readDbRecordFromServers,
|
|
9
9
|
readLiveDbRecordAfterTombstoneMerge
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-3YIAR5UI.js";
|
|
11
11
|
import {
|
|
12
12
|
fetchWithTransientRetry
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-5UTFL4QJ.js";
|
|
14
14
|
import {
|
|
15
15
|
DRAIN_EXHAUSTED_USER_MESSAGE,
|
|
16
16
|
isDrainExhaustedResponse
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
import {
|
|
19
19
|
buildDialogAttachmentPlan,
|
|
20
20
|
extractFileContentIds
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-3BMYXEUW.js";
|
|
22
22
|
import {
|
|
23
23
|
isLevelLockError
|
|
24
24
|
} from "./chunk-URMS4XY2.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
boundSummaryText,
|
|
31
31
|
buildDialogReadEnvelope,
|
|
32
32
|
projectDialogReadForAgent
|
|
33
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-HCT7U36O.js";
|
|
34
34
|
import {
|
|
35
35
|
toErrorMessage
|
|
36
36
|
} from "./chunk-HNMXYYJR.js";
|
|
@@ -51,19 +51,19 @@ import {
|
|
|
51
51
|
import {
|
|
52
52
|
asNonEmptyStringArray,
|
|
53
53
|
asTrimmedNonEmptyStringArray
|
|
54
|
-
} from "./chunk-
|
|
54
|
+
} from "./chunk-VMFTFOWF.js";
|
|
55
55
|
import {
|
|
56
56
|
createClientLogger
|
|
57
57
|
} from "./chunk-QOKAKDPE.js";
|
|
58
58
|
import {
|
|
59
59
|
isLevelNotFoundError
|
|
60
60
|
} from "./chunk-OW765XBU.js";
|
|
61
|
-
import {
|
|
62
|
-
asTrimmedString
|
|
63
|
-
} from "./chunk-3EUW3WEO.js";
|
|
64
61
|
import {
|
|
65
62
|
isRecord
|
|
66
63
|
} from "./chunk-KUG52IAP.js";
|
|
64
|
+
import {
|
|
65
|
+
asTrimmedString
|
|
66
|
+
} from "./chunk-3EUW3WEO.js";
|
|
67
67
|
import {
|
|
68
68
|
DEFAULT_LOCAL_API_ORIGIN
|
|
69
69
|
} from "./chunk-4SN6J65J.js";
|
|
@@ -210,7 +210,8 @@ var VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
210
210
|
"--token",
|
|
211
211
|
"--machine-key",
|
|
212
212
|
"--user",
|
|
213
|
-
"--max-response-chars"
|
|
213
|
+
"--max-response-chars",
|
|
214
|
+
"--per-dialog"
|
|
214
215
|
]);
|
|
215
216
|
function hasFlag(args, flag) {
|
|
216
217
|
return args.includes(flag);
|
|
@@ -724,7 +725,7 @@ function isExplicitDialogIdMismatch(meta, dialogId) {
|
|
|
724
725
|
return meta && typeof meta === "object" && "id" in meta && meta.id != null && String(meta.id) !== dialogId;
|
|
725
726
|
}
|
|
726
727
|
async function readDialogFromLocalDb(dialogKey, dialogId, limit, readLocalDialog) {
|
|
727
|
-
const reader = readLocalDialog ?? (await import("./localDialogRead-
|
|
728
|
+
const reader = readLocalDialog ?? (await import("./localDialogRead-BTFJ4V2I.js")).readDialogFromLocalDb;
|
|
728
729
|
const result = await reader({ dialogKey, dialogId, limit });
|
|
729
730
|
return {
|
|
730
731
|
...result,
|
|
@@ -741,7 +742,7 @@ async function readLocalDialogAtDbPathDefault(args) {
|
|
|
741
742
|
const [{ Level }, { safeJsonEncoding }, { fetchMessages }] = await Promise.all([
|
|
742
743
|
import("./levelLazyShim-GZBKODGI.js"),
|
|
743
744
|
import("./serverStoreFactory-YMXDF4NI.js"),
|
|
744
|
-
import("./fetchMessages-
|
|
745
|
+
import("./fetchMessages-EIU7UFFK.js")
|
|
745
746
|
]);
|
|
746
747
|
const db = new Level(args.dbPath, {
|
|
747
748
|
valueEncoding: safeJsonEncoding,
|
|
@@ -1820,6 +1821,129 @@ async function runDialogDeleteCommand(args, deps = {}) {
|
|
|
1820
1821
|
}
|
|
1821
1822
|
return hasErrors ? 1 : 0;
|
|
1822
1823
|
}
|
|
1824
|
+
function printSearchUsage(output) {
|
|
1825
|
+
output.write(`Usage:
|
|
1826
|
+
nolo dialog search <query> [--limit <n>] [--per-dialog <n>] [--json]
|
|
1827
|
+
|
|
1828
|
+
Options:
|
|
1829
|
+
--limit <n> Max dialogs to return (default 20, max 50).
|
|
1830
|
+
--per-dialog <n> Max match snippets per dialog (default 3, max 10).
|
|
1831
|
+
--json Print machine-readable JSON.
|
|
1832
|
+
--server <url> Override NOLO_SERVER/BASE_URL.
|
|
1833
|
+
--token <jwt> Override AUTH_TOKEN.
|
|
1834
|
+
|
|
1835
|
+
Searches messages across the current user's dialogs via the server endpoint.
|
|
1836
|
+
Server requires NOLO_DIALOG_SEARCH=1 to be enabled.
|
|
1837
|
+
`);
|
|
1838
|
+
}
|
|
1839
|
+
async function runDialogSearchCommand(args, deps = {}) {
|
|
1840
|
+
const env = deps.env ?? process.env;
|
|
1841
|
+
const output = deps.output ?? process.stdout;
|
|
1842
|
+
if (hasFlag(args, "--help") || hasFlag(args, "-h")) {
|
|
1843
|
+
printSearchUsage(output);
|
|
1844
|
+
return 0;
|
|
1845
|
+
}
|
|
1846
|
+
const query = readFirstPositional(args);
|
|
1847
|
+
if (!query) {
|
|
1848
|
+
output.write("[nolo] dialog search requires a search query.\n\n");
|
|
1849
|
+
printSearchUsage(output);
|
|
1850
|
+
return 1;
|
|
1851
|
+
}
|
|
1852
|
+
const authToken = resolveAuthToken(args, env);
|
|
1853
|
+
if (!authToken) {
|
|
1854
|
+
output.write("[nolo] dialog search requires an auth token. Run `nolo login` or set AUTH_TOKEN.\n");
|
|
1855
|
+
return 1;
|
|
1856
|
+
}
|
|
1857
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
1858
|
+
const serverUrl = resolveServerUrl(args, env);
|
|
1859
|
+
const serverUrls = resolveServerCandidates(args, env, serverUrl);
|
|
1860
|
+
const limitRaw = readOption(args, "--limit");
|
|
1861
|
+
const perDialogRaw = readOption(args, "--per-dialog");
|
|
1862
|
+
const queryParams = new URLSearchParams({ q: query });
|
|
1863
|
+
if (limitRaw) queryParams.set("limit", limitRaw);
|
|
1864
|
+
if (perDialogRaw) queryParams.set("perDialog", perDialogRaw);
|
|
1865
|
+
const isJson = hasFlag(args, "--json");
|
|
1866
|
+
let lastError = null;
|
|
1867
|
+
let lastStatus = null;
|
|
1868
|
+
let searchResult = null;
|
|
1869
|
+
for (const candidateBase of serverUrls) {
|
|
1870
|
+
const trimmedBase = candidateBase.replace(/\/+$/, "");
|
|
1871
|
+
const targetUrl = `${trimmedBase}/api/dialog-search?${queryParams.toString()}`;
|
|
1872
|
+
try {
|
|
1873
|
+
const res = await fetchImpl(targetUrl, {
|
|
1874
|
+
method: "GET",
|
|
1875
|
+
headers: {
|
|
1876
|
+
Authorization: `Bearer ${authToken}`
|
|
1877
|
+
}
|
|
1878
|
+
});
|
|
1879
|
+
lastStatus = res.status;
|
|
1880
|
+
if (!res.ok) {
|
|
1881
|
+
const errorData = await res.json().catch(() => ({}));
|
|
1882
|
+
if (res.status === 403) {
|
|
1883
|
+
const hint = errorData?.hint ? ` (${errorData.hint})` : "";
|
|
1884
|
+
const msg = errorData?.message ? `: ${errorData.message}` : "";
|
|
1885
|
+
throw new Error(`Server returned 403 Forbidden${hint}${msg}. Please ensure NOLO_DIALOG_SEARCH=1 is enabled on the server.`);
|
|
1886
|
+
}
|
|
1887
|
+
if (res.status === 401) {
|
|
1888
|
+
throw new Error(`Server returned 401 Unauthorized. Please check your AUTH_TOKEN.`);
|
|
1889
|
+
}
|
|
1890
|
+
throw new Error(`HTTP ${res.status}: ${JSON.stringify(errorData)}`);
|
|
1891
|
+
}
|
|
1892
|
+
searchResult = await res.json();
|
|
1893
|
+
break;
|
|
1894
|
+
} catch (err) {
|
|
1895
|
+
lastError = err;
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
if (!searchResult) {
|
|
1899
|
+
const errorMsg = lastError ? toErrorMessage(lastError) : "Failed to connect to candidate servers";
|
|
1900
|
+
if (isJson) {
|
|
1901
|
+
output.write(JSON.stringify({ error: errorMsg, status: lastStatus }, null, 2) + "\n");
|
|
1902
|
+
} else {
|
|
1903
|
+
output.write(`[nolo] dialog search failed: ${errorMsg}
|
|
1904
|
+
`);
|
|
1905
|
+
}
|
|
1906
|
+
return 1;
|
|
1907
|
+
}
|
|
1908
|
+
if (isJson) {
|
|
1909
|
+
output.write(JSON.stringify(searchResult, null, 2) + "\n");
|
|
1910
|
+
return 0;
|
|
1911
|
+
}
|
|
1912
|
+
const { dialogs, totalMatches, scannedDialogs, scannedMessages, elapsedMs, truncated } = searchResult;
|
|
1913
|
+
output.write(`query: ${query}
|
|
1914
|
+
`);
|
|
1915
|
+
output.write(`scanned: ${scannedDialogs} dialogs, ${scannedMessages} messages (${elapsedMs}ms)
|
|
1916
|
+
`);
|
|
1917
|
+
output.write(`matches: ${totalMatches} total match(es) across ${dialogs?.length ?? 0} dialog(s)`);
|
|
1918
|
+
if (truncated) {
|
|
1919
|
+
output.write(" [truncated]");
|
|
1920
|
+
}
|
|
1921
|
+
output.write("\n");
|
|
1922
|
+
if (!Array.isArray(dialogs) || dialogs.length === 0) {
|
|
1923
|
+
output.write("\nNo matching dialog messages found.\n");
|
|
1924
|
+
return 0;
|
|
1925
|
+
}
|
|
1926
|
+
for (const d of dialogs) {
|
|
1927
|
+
output.write(`
|
|
1928
|
+
${d.title}
|
|
1929
|
+
`);
|
|
1930
|
+
output.write(`id=${d.dialogId}
|
|
1931
|
+
`);
|
|
1932
|
+
output.write(`updatedAt=${d.updatedAt ?? "-"}
|
|
1933
|
+
`);
|
|
1934
|
+
output.write(`matches=${d.matchCount}
|
|
1935
|
+
`);
|
|
1936
|
+
if (Array.isArray(d.matches) && d.matches.length > 0) {
|
|
1937
|
+
for (const m of d.matches) {
|
|
1938
|
+
const role = m.role ? `[${m.role}]` : "";
|
|
1939
|
+
const snippet = String(m.snippet ?? "").replace(/\r?\n/g, " ");
|
|
1940
|
+
output.write(` - ${role} ${snippet}
|
|
1941
|
+
`);
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
return 0;
|
|
1946
|
+
}
|
|
1823
1947
|
|
|
1824
1948
|
export {
|
|
1825
1949
|
normalizeDialogRecord,
|
|
@@ -1832,5 +1956,6 @@ export {
|
|
|
1832
1956
|
runDialogStatusCommand,
|
|
1833
1957
|
runDialogQueryCommand,
|
|
1834
1958
|
runDialogListCommand,
|
|
1835
|
-
runDialogDeleteCommand
|
|
1959
|
+
runDialogDeleteCommand,
|
|
1960
|
+
runDialogSearchCommand
|
|
1836
1961
|
};
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
asRecordOrEmpty
|
|
3
3
|
} from "./chunk-KX6YBIHG.js";
|
|
4
|
-
import {
|
|
5
|
-
asOptionalFiniteNumber
|
|
6
|
-
} from "./chunk-WWC7I6TA.js";
|
|
7
4
|
import {
|
|
8
5
|
asNonEmptyStringArray,
|
|
9
6
|
asTrimmedNonEmptyStringArray
|
|
10
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-VMFTFOWF.js";
|
|
8
|
+
import {
|
|
9
|
+
asOptionalFiniteNumber
|
|
10
|
+
} from "./chunk-WWC7I6TA.js";
|
|
11
11
|
import {
|
|
12
12
|
isOwnedAgentKey,
|
|
13
13
|
ownedAgentKey,
|
|
14
14
|
publicAgentKey
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-M2EJHDJP.js";
|
|
16
16
|
import {
|
|
17
17
|
isRecord
|
|
18
18
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -25,6 +25,7 @@ var DEFAULT_PRIVATE_NOLO_WORKSPACE_TOOLS = [
|
|
|
25
25
|
"listDialogs",
|
|
26
26
|
"readDialog",
|
|
27
27
|
"queryDialogsBySubjectRef",
|
|
28
|
+
"deleteDialogs",
|
|
28
29
|
"listAgents",
|
|
29
30
|
"readAgent",
|
|
30
31
|
"listSpaces",
|
|
@@ -853,6 +854,7 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
853
854
|
}
|
|
854
855
|
}, ["query"]);
|
|
855
856
|
add("listAgents", "List agents for delegation. Default scope='preferred' returns the user's favorites, owned, OAuth, custom API, and local agents only; scope='public' discovers shared/marketplace agents; scope='all' returns their deduplicated union. Public agents may consume platform credits. Copy the agentKey verbatim; use the runnable agentKey exactly and do not infer it from the display name. publicOnly is deprecated compatibility for scope='public'. Rate-limited agents are hidden unless showUnavailable is true.", {
|
|
857
|
+
query: stringToolParam("Optional case-insensitive search substring matching agent name, model, provider, handle, or agentKey."),
|
|
856
858
|
scope: { type: "string", enum: ["preferred", "public", "all"], description: "Discovery scope; preferred is the default and does not load the public marketplace." },
|
|
857
859
|
publicOnly: { type: "boolean", description: "Deprecated compatibility alias for scope='public'." },
|
|
858
860
|
showUnavailable: { type: "boolean", description: "Include agents currently rate-limited (429). Default false." },
|
|
@@ -1182,6 +1184,8 @@ function buildNoloWorkspaceCommandArgs(call) {
|
|
|
1182
1184
|
}
|
|
1183
1185
|
case "listAgents": {
|
|
1184
1186
|
const cliArgs = ["agent", "list"];
|
|
1187
|
+
const query = noloStringArg(args.query);
|
|
1188
|
+
if (query) cliArgs.push("--query", query);
|
|
1185
1189
|
const space = noloStringArg(args.space);
|
|
1186
1190
|
if (space) cliArgs.push("--space", space);
|
|
1187
1191
|
const scope = noloStringArg(args.scope);
|
|
@@ -1,25 +1,61 @@
|
|
|
1
1
|
import {
|
|
2
2
|
normalizeTimingMs
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-P5EVSOPA.js";
|
|
4
4
|
import {
|
|
5
5
|
MODEL_LOOKUP_MAP
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-OIVSQH2O.js";
|
|
7
7
|
import {
|
|
8
8
|
ALL_MODELS
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-ACTMNVHM.js";
|
|
10
|
+
import {
|
|
11
|
+
asTrimmedNonEmptyStringArray
|
|
12
|
+
} from "./chunk-VMFTFOWF.js";
|
|
10
13
|
import {
|
|
11
14
|
asOptionalFiniteNumber
|
|
12
15
|
} from "./chunk-WWC7I6TA.js";
|
|
13
|
-
import {
|
|
14
|
-
asTrimmedNonEmptyStringArray
|
|
15
|
-
} from "./chunk-I42VC5KR.js";
|
|
16
16
|
import {
|
|
17
17
|
BUILTIN_NOLO_AGENT_KEY
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-BNGW5ASC.js";
|
|
19
19
|
import {
|
|
20
20
|
asOptionalTrimmedString
|
|
21
21
|
} from "./chunk-G3SUCT4W.js";
|
|
22
22
|
|
|
23
|
+
// packages/ai/token/cacheTokenFields.ts
|
|
24
|
+
var finiteTokenCount = (value) => {
|
|
25
|
+
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
26
|
+
return Math.max(0, Math.floor(value));
|
|
27
|
+
};
|
|
28
|
+
var readNested = (value, path) => {
|
|
29
|
+
let cursor = value;
|
|
30
|
+
for (const key of path) {
|
|
31
|
+
if (!cursor || typeof cursor !== "object") return void 0;
|
|
32
|
+
cursor = cursor[key];
|
|
33
|
+
}
|
|
34
|
+
return finiteTokenCount(cursor);
|
|
35
|
+
};
|
|
36
|
+
var firstPositive = (usage, readers) => {
|
|
37
|
+
for (const read of readers) {
|
|
38
|
+
const value = read(usage);
|
|
39
|
+
if (value !== void 0 && value !== 0) return value;
|
|
40
|
+
}
|
|
41
|
+
return 0;
|
|
42
|
+
};
|
|
43
|
+
var topLevel = (field) => (usage) => {
|
|
44
|
+
if (!usage || typeof usage !== "object") return void 0;
|
|
45
|
+
return finiteTokenCount(usage[field]);
|
|
46
|
+
};
|
|
47
|
+
var nested = (path) => (usage) => readNested(usage, path);
|
|
48
|
+
var readCacheReadInputTokens = (usage) => firstPositive(usage, [
|
|
49
|
+
topLevel("cache_read_input_tokens"),
|
|
50
|
+
topLevel("prompt_cache_hit_tokens"),
|
|
51
|
+
nested(["input_tokens_details", "cached_tokens"]),
|
|
52
|
+
nested(["prompt_tokens_details", "cached_tokens"])
|
|
53
|
+
]);
|
|
54
|
+
var readCacheCreationInputTokens = (usage) => firstPositive(usage, [
|
|
55
|
+
topLevel("cache_creation_input_tokens"),
|
|
56
|
+
topLevel("prompt_cache_miss_tokens")
|
|
57
|
+
]);
|
|
58
|
+
|
|
23
59
|
// packages/ai/llm/getModelContextWindow.ts
|
|
24
60
|
var DEFAULT_CONTEXT_WINDOW = 256e3;
|
|
25
61
|
var QWEN_3_6_CONTEXT_WINDOW = 262144;
|
|
@@ -157,42 +193,6 @@ var getModelInfo = (modelName) => {
|
|
|
157
193
|
return map.get(modelName) || map.get(modelName.toLowerCase()) || null;
|
|
158
194
|
};
|
|
159
195
|
|
|
160
|
-
// packages/ai/token/cacheTokenFields.ts
|
|
161
|
-
var finiteTokenCount = (value) => {
|
|
162
|
-
if (typeof value !== "number" || !Number.isFinite(value)) return void 0;
|
|
163
|
-
return Math.max(0, Math.floor(value));
|
|
164
|
-
};
|
|
165
|
-
var readNested = (value, path) => {
|
|
166
|
-
let cursor = value;
|
|
167
|
-
for (const key of path) {
|
|
168
|
-
if (!cursor || typeof cursor !== "object") return void 0;
|
|
169
|
-
cursor = cursor[key];
|
|
170
|
-
}
|
|
171
|
-
return finiteTokenCount(cursor);
|
|
172
|
-
};
|
|
173
|
-
var firstPositive = (usage, readers) => {
|
|
174
|
-
for (const read of readers) {
|
|
175
|
-
const value = read(usage);
|
|
176
|
-
if (value !== void 0 && value !== 0) return value;
|
|
177
|
-
}
|
|
178
|
-
return 0;
|
|
179
|
-
};
|
|
180
|
-
var topLevel = (field) => (usage) => {
|
|
181
|
-
if (!usage || typeof usage !== "object") return void 0;
|
|
182
|
-
return finiteTokenCount(usage[field]);
|
|
183
|
-
};
|
|
184
|
-
var nested = (path) => (usage) => readNested(usage, path);
|
|
185
|
-
var readCacheReadInputTokens = (usage) => firstPositive(usage, [
|
|
186
|
-
topLevel("cache_read_input_tokens"),
|
|
187
|
-
topLevel("prompt_cache_hit_tokens"),
|
|
188
|
-
nested(["input_tokens_details", "cached_tokens"]),
|
|
189
|
-
nested(["prompt_tokens_details", "cached_tokens"])
|
|
190
|
-
]);
|
|
191
|
-
var readCacheCreationInputTokens = (usage) => firstPositive(usage, [
|
|
192
|
-
topLevel("cache_creation_input_tokens"),
|
|
193
|
-
topLevel("prompt_cache_miss_tokens")
|
|
194
|
-
]);
|
|
195
|
-
|
|
196
196
|
// packages/ai/token/normalizeUsage.ts
|
|
197
197
|
var normalizeStringArray = (value) => {
|
|
198
198
|
if (!Array.isArray(value)) return void 0;
|
|
@@ -5,16 +5,16 @@ import {
|
|
|
5
5
|
} from "./chunk-ONXOABJR.js";
|
|
6
6
|
import {
|
|
7
7
|
asNonEmptyStringArray
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-VMFTFOWF.js";
|
|
9
|
+
import {
|
|
10
|
+
isRecord
|
|
11
|
+
} from "./chunk-KUG52IAP.js";
|
|
9
12
|
import {
|
|
10
13
|
asTrimmedString
|
|
11
14
|
} from "./chunk-3EUW3WEO.js";
|
|
12
15
|
import {
|
|
13
16
|
asOptionalPositiveFiniteNumber
|
|
14
17
|
} from "./chunk-U6VC4MU4.js";
|
|
15
|
-
import {
|
|
16
|
-
isRecord
|
|
17
|
-
} from "./chunk-KUG52IAP.js";
|
|
18
18
|
|
|
19
19
|
// packages/agent-runtime/fileCredentialBroker.ts
|
|
20
20
|
import {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getActiveDialogKey
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6D2JFXLY.js";
|
|
4
4
|
import {
|
|
5
5
|
compactWhitespace
|
|
6
6
|
} from "./chunk-DWLEOOGR.js";
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
} from "./chunk-QSJ3HFEF.js";
|
|
10
10
|
import {
|
|
11
11
|
extractCustomId
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-M2EJHDJP.js";
|
|
13
13
|
import {
|
|
14
14
|
selectIdentityToken
|
|
15
15
|
} from "./chunk-SEJ5OS6F.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isAgentRunTerminalStatus
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3VNWWVKB.js";
|
|
4
4
|
import {
|
|
5
5
|
isCompiledBinary,
|
|
6
6
|
resolveCliEntrypointPath
|
|
@@ -11,6 +11,60 @@ import { homedir as nodeHomedir } from "node:os";
|
|
|
11
11
|
import { dirname, isAbsolute, join, resolve } from "node:path";
|
|
12
12
|
import * as nodeFs from "node:fs";
|
|
13
13
|
import { execFileSync as nodeExecFileSync, spawn as nodeSpawn } from "node:child_process";
|
|
14
|
+
|
|
15
|
+
// packages/ai/tools/agent/runFailureClass.ts
|
|
16
|
+
var RATE_LIMIT_PATTERN = /429|rate.?limit|quota|insufficient.?balance|UPSTREAM_402|cooling|冷却/i;
|
|
17
|
+
var PROVIDER_ERROR_PATTERN = /provider|upstream|5\d\d|bad.?gateway|service.?unavailable|overloaded/i;
|
|
18
|
+
var MALFORMED_PATTERN = /MALFORMED_FUNCTION_CALL|malformed|invalid.?function.?call|invalid.?tool.?call/i;
|
|
19
|
+
var STALLED_PATTERN = /stall|no.?progress|repetition|stagnant|无进展|卡死/i;
|
|
20
|
+
var TOOL_ERROR_PATTERN = /tool.?error|tool.?fail|工具/i;
|
|
21
|
+
function classifyRunFailure(input) {
|
|
22
|
+
const status = typeof input.status === "string" ? input.status : "";
|
|
23
|
+
if (status === "done" || status === "killed" || status === "cancelled") {
|
|
24
|
+
return void 0;
|
|
25
|
+
}
|
|
26
|
+
const reason = typeof input.failureReason === "string" ? input.failureReason : "";
|
|
27
|
+
const message = typeof input.errorMessage === "string" ? input.errorMessage : "";
|
|
28
|
+
switch (reason) {
|
|
29
|
+
case "provider_rate_limited":
|
|
30
|
+
return { failureClass: "rate_limited", retryable: true };
|
|
31
|
+
case "provider_error":
|
|
32
|
+
return MALFORMED_PATTERN.test(message) ? { failureClass: "provider_error", retryable: false } : { failureClass: "provider_error", retryable: true };
|
|
33
|
+
case "stalled":
|
|
34
|
+
return { failureClass: "stalled", retryable: false };
|
|
35
|
+
case "tool_error":
|
|
36
|
+
return { failureClass: "tool_error", retryable: false };
|
|
37
|
+
case "config_unresolved":
|
|
38
|
+
return { failureClass: "unknown", retryable: false };
|
|
39
|
+
case "cancelled":
|
|
40
|
+
return void 0;
|
|
41
|
+
default:
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
if (message) {
|
|
45
|
+
if (RATE_LIMIT_PATTERN.test(message)) {
|
|
46
|
+
return { failureClass: "rate_limited", retryable: true };
|
|
47
|
+
}
|
|
48
|
+
if (MALFORMED_PATTERN.test(message)) {
|
|
49
|
+
return { failureClass: "provider_error", retryable: false };
|
|
50
|
+
}
|
|
51
|
+
if (STALLED_PATTERN.test(message)) {
|
|
52
|
+
return { failureClass: "stalled", retryable: false };
|
|
53
|
+
}
|
|
54
|
+
if (TOOL_ERROR_PATTERN.test(message)) {
|
|
55
|
+
return { failureClass: "tool_error", retryable: false };
|
|
56
|
+
}
|
|
57
|
+
if (PROVIDER_ERROR_PATTERN.test(message)) {
|
|
58
|
+
return { failureClass: "provider_error", retryable: true };
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (status === "failed" || status === "timeout" || status === "orphaned") {
|
|
62
|
+
return { failureClass: "unknown", retryable: false };
|
|
63
|
+
}
|
|
64
|
+
return void 0;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// packages/cli/agentRunControl.ts
|
|
14
68
|
var RUN_TERMINAL_STATUSES = /* @__PURE__ */ new Set([
|
|
15
69
|
"done",
|
|
16
70
|
"failed",
|
|
@@ -405,6 +459,8 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
|
|
|
405
459
|
const fs = deps.fs ?? nodeFs;
|
|
406
460
|
const now = deps.now ?? (() => /* @__PURE__ */ new Date());
|
|
407
461
|
const minWriteIntervalMs = options.minWriteIntervalMs ?? DEFAULT_ACTIVITY_WRITE_INTERVAL_MS;
|
|
462
|
+
const keepAlive = options.keepAlive ?? true;
|
|
463
|
+
let disposed = false;
|
|
408
464
|
let lastEventAt = now().toISOString();
|
|
409
465
|
let inFlight = null;
|
|
410
466
|
const counters = { llmCalls: 0, toolCalls: 0, fileEdits: 0 };
|
|
@@ -425,7 +481,9 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
|
|
|
425
481
|
};
|
|
426
482
|
}
|
|
427
483
|
function doWrite() {
|
|
484
|
+
if (disposed) return;
|
|
428
485
|
writeTimer = void 0;
|
|
486
|
+
const attemptAt = now().getTime();
|
|
429
487
|
withRunRecordLock(
|
|
430
488
|
runId,
|
|
431
489
|
deps,
|
|
@@ -438,7 +496,10 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
|
|
|
438
496
|
},
|
|
439
497
|
{ strict: true }
|
|
440
498
|
);
|
|
499
|
+
if (lastWriteAt < attemptAt) lastWriteAt = attemptAt;
|
|
500
|
+
if (keepAlive) scheduleWrite();
|
|
441
501
|
}
|
|
502
|
+
scheduleWrite();
|
|
442
503
|
function scheduleWrite() {
|
|
443
504
|
if (writeTimer !== void 0) return;
|
|
444
505
|
const elapsed = now().getTime() - lastWriteAt;
|
|
@@ -446,6 +507,7 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
|
|
|
446
507
|
writeTimer = setTimeout(doWrite, delay);
|
|
447
508
|
}
|
|
448
509
|
function onLoopEvent(event) {
|
|
510
|
+
if (disposed) return;
|
|
449
511
|
lastEventAt = new Date(event.atMs).toISOString();
|
|
450
512
|
switch (event.kind) {
|
|
451
513
|
case "llm-start":
|
|
@@ -480,6 +542,7 @@ function createRunActivityTracker(runId, deps = {}, options = {}) {
|
|
|
480
542
|
doWrite();
|
|
481
543
|
}
|
|
482
544
|
function dispose() {
|
|
545
|
+
disposed = true;
|
|
483
546
|
if (writeTimer !== void 0) {
|
|
484
547
|
clearTimeout(writeTimer);
|
|
485
548
|
writeTimer = void 0;
|
|
@@ -785,6 +848,7 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
|
|
|
785
848
|
logPath,
|
|
786
849
|
queuePath,
|
|
787
850
|
batchId,
|
|
851
|
+
...typeof input.credentialGroup === "string" && input.credentialGroup.trim() ? { credentialGroup: input.credentialGroup.trim() } : {},
|
|
788
852
|
...typeof input.parentDialogId === "string" && input.parentDialogId.trim() ? { parentDialogId: input.parentDialogId.trim() } : {},
|
|
789
853
|
...dodCommands && dodCommands.length > 0 ? { dodCommands } : {},
|
|
790
854
|
...spawnHead ? { spawnHead } : {},
|
|
@@ -817,10 +881,13 @@ async function spawnLocalBackgroundRun(input, deps = {}) {
|
|
|
817
881
|
});
|
|
818
882
|
proc.unref();
|
|
819
883
|
if (typeof proc.pid === "number") {
|
|
820
|
-
record.pid = proc.pid;
|
|
821
884
|
const processStartedAt = (deps.getProcessStartTime ?? defaultGetProcessStartTime)(proc.pid);
|
|
822
|
-
|
|
823
|
-
|
|
885
|
+
withRunRecordLock(runId, deps, () => {
|
|
886
|
+
const latest = readRunRecord(runId, deps) ?? record;
|
|
887
|
+
latest.pid = proc.pid;
|
|
888
|
+
if (processStartedAt) latest.processStartedAt = processStartedAt.toISOString();
|
|
889
|
+
writeRunRecord(latest, deps);
|
|
890
|
+
});
|
|
824
891
|
}
|
|
825
892
|
return { runId, pid: proc.pid, logPath, queuePath, batchId };
|
|
826
893
|
}
|
|
@@ -913,6 +980,15 @@ function transitionRunToTerminal(runId, update, deps = {}, options = {}) {
|
|
|
913
980
|
} else if (update.status === "killed") {
|
|
914
981
|
record2.failureReason = "cancelled";
|
|
915
982
|
}
|
|
983
|
+
const classification = classifyRunFailure({
|
|
984
|
+
status: update.status,
|
|
985
|
+
failureReason: record2.failureReason,
|
|
986
|
+
errorMessage: update.note ?? record2.note
|
|
987
|
+
});
|
|
988
|
+
if (classification) {
|
|
989
|
+
record2.failureClass = classification.failureClass;
|
|
990
|
+
record2.retryable = classification.retryable;
|
|
991
|
+
}
|
|
916
992
|
const resolvedToolCount = typeof update.toolCallCount === "number" ? update.toolCallCount : record2.activity?.counters?.toolCalls;
|
|
917
993
|
if (typeof resolvedToolCount === "number") {
|
|
918
994
|
record2.toolCallCount = resolvedToolCount;
|
|
@@ -1032,6 +1108,15 @@ function checkStaleRun(runId, deps = {}) {
|
|
|
1032
1108
|
const at = now().toISOString();
|
|
1033
1109
|
latest.status = "orphaned";
|
|
1034
1110
|
latest.note = pidReused ? "orphaned: process gone (pid reused by another process)" : "orphaned: process gone without writing terminal status";
|
|
1111
|
+
const orphanClassification = classifyRunFailure({
|
|
1112
|
+
status: "orphaned",
|
|
1113
|
+
failureReason: latest.failureReason,
|
|
1114
|
+
errorMessage: latest.note
|
|
1115
|
+
});
|
|
1116
|
+
if (orphanClassification) {
|
|
1117
|
+
latest.failureClass = orphanClassification.failureClass;
|
|
1118
|
+
latest.retryable = orphanClassification.retryable;
|
|
1119
|
+
}
|
|
1035
1120
|
latest.endedAt = at;
|
|
1036
1121
|
latest.reconciledAt = at;
|
|
1037
1122
|
latest.pid = void 0;
|
|
@@ -1247,6 +1332,18 @@ function printStatusOnce(record, deps) {
|
|
|
1247
1332
|
}
|
|
1248
1333
|
if (record.note) deps.output.write(`note: ${record.note}
|
|
1249
1334
|
`);
|
|
1335
|
+
if (record.failureReason) deps.output.write(`failure: ${record.failureReason}
|
|
1336
|
+
`);
|
|
1337
|
+
if (record.failureClass) {
|
|
1338
|
+
deps.output.write(
|
|
1339
|
+
`class: ${record.failureClass}${typeof record.retryable === "boolean" ? ` (retryable=${record.retryable})` : ""}
|
|
1340
|
+
`
|
|
1341
|
+
);
|
|
1342
|
+
}
|
|
1343
|
+
if (record.credentialGroup) {
|
|
1344
|
+
deps.output.write(`credGroup: ${record.credentialGroup}
|
|
1345
|
+
`);
|
|
1346
|
+
}
|
|
1250
1347
|
const activitySummary = formatActivitySummary(record.activity);
|
|
1251
1348
|
if (activitySummary) deps.output.write(`${activitySummary}
|
|
1252
1349
|
`);
|
|
@@ -1376,14 +1473,20 @@ async function terminateRunProcess(record, initialSignal, deps) {
|
|
|
1376
1473
|
signalGroup(initialSignal);
|
|
1377
1474
|
if (initialSignal === "SIGTERM") {
|
|
1378
1475
|
const deadline = nowMs() + TERMINATE_GRACE_MS;
|
|
1379
|
-
|
|
1476
|
+
const maxIterations = Math.ceil(TERMINATE_GRACE_MS / TERMINATE_POLL_MS) + 1;
|
|
1477
|
+
let iterations = 0;
|
|
1478
|
+
while (!isPidGone(pid, deps) && nowMs() < deadline && iterations < maxIterations) {
|
|
1479
|
+
iterations += 1;
|
|
1380
1480
|
await sleep(TERMINATE_POLL_MS);
|
|
1381
1481
|
}
|
|
1382
1482
|
}
|
|
1383
1483
|
if (!isPidGone(pid, deps)) {
|
|
1384
1484
|
signalGroup("SIGKILL");
|
|
1385
1485
|
const killDeadline = nowMs() + TERMINATE_KILL_GRACE_MS;
|
|
1386
|
-
|
|
1486
|
+
const maxIterations = Math.ceil(TERMINATE_KILL_GRACE_MS / TERMINATE_POLL_MS) + 1;
|
|
1487
|
+
let iterations = 0;
|
|
1488
|
+
while (!isPidGone(pid, deps) && nowMs() < killDeadline && iterations < maxIterations) {
|
|
1489
|
+
iterations += 1;
|
|
1387
1490
|
await sleep(TERMINATE_POLL_MS);
|
|
1388
1491
|
}
|
|
1389
1492
|
}
|
|
@@ -199,7 +199,7 @@ async function readDocFunc(args, thunkApi) {
|
|
|
199
199
|
throw new Error(`\u65E0\u6548\u7684\u9875\u9762 ID: ${id}\u3002\u9875\u9762 ID \u901A\u5E38\u4EE5 "page-" \u5F00\u5934\u3002`);
|
|
200
200
|
}
|
|
201
201
|
try {
|
|
202
|
-
const { readAction } = await import("./read-
|
|
202
|
+
const { readAction } = await import("./read-COE3ZYR6.js");
|
|
203
203
|
const pageData = await readAction({ dbKey: id }, thunkApi);
|
|
204
204
|
if (!pageData) {
|
|
205
205
|
throw new Error(`\u672A\u627E\u5230 ID \u4E3A ${id} \u7684\u9875\u9762\u3002`);
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
toolRegistry
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-3BGIKIPF.js";
|
|
4
4
|
import {
|
|
5
5
|
i18n_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XP3VVAPG.js";
|
|
7
7
|
import {
|
|
8
8
|
canonicalizeToolNames
|
|
9
9
|
} from "./chunk-O6OSWFZQ.js";
|
|
10
10
|
import {
|
|
11
11
|
isNoloHostedProvider
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-Q67DOFOO.js";
|
|
13
13
|
import {
|
|
14
14
|
asTrimmedLowercaseString
|
|
15
15
|
} from "./chunk-QSJ3HFEF.js";
|