nolo-cli 0.33.0-alpha.3 → 0.33.0-alpha.30
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/{_executeModel-RWPVI3YV.js → _executeModel-G2YBBSYF.js} +53 -53
- package/{action-SMLG6OTB.js → action-4KWNL4XI.js} +10 -10
- package/{addContentAction-SFO244QN.js → addContentAction-SUL5AFLY.js} +8 -8
- package/{addDialogAgentAction-W44ZCEHB.js → addDialogAgentAction-T645TULN.js} +7 -7
- package/{agentDeleteCommand-KU2RXQPP.js → agentDeleteCommand-DZPB57QC.js} +47 -43
- package/{agentEmailCommands-MPCMDENS.js → agentEmailCommands-5UPJMRRT.js} +79 -75
- package/{agentListCommands-EPD4N6FX.js → agentListCommands-FHWEJ56M.js} +47 -42
- package/{agentMachineCommands-AF7C3YRT.js → agentMachineCommands-FNVJTZ3J.js} +44 -40
- package/agentProviderCommands-65ZC2WB4.js +122 -0
- package/{agentPullCommand-YH5GEBK4.js → agentPullCommand-NYHSK6EW.js} +3 -3
- package/{agentRecordCommands-EYE6MZZG.js → agentRecordCommands-JN2L5AMM.js} +70 -66
- package/{agentRunCommand-LL22SGTN.js → agentRunCommand-R57HN7XZ.js} +76 -71
- package/{agentRuntimeLocal-JX34G47Z.js → agentRuntimeLocal-MXIGYCZW.js} +32 -29
- package/{agentSlice-TNMFQQOV.js → agentSlice-L3S542FP.js} +10 -10
- package/{appDeleteCommands-43K5VXQB.js → appDeleteCommands-LF6HKT65.js} +39 -35
- package/{appDeployCommands-FEEJSVDZ.js → appDeployCommands-S5M2FFQS.js} +39 -35
- package/{appDeployStatusCommands-H76CG45R.js → appDeployStatusCommands-AVT2B5LY.js} +39 -35
- package/{appGetCommands-MDZYFTYZ.js → appGetCommands-ACH4E3F4.js} +39 -35
- package/{appListCommands-TUJJXPWG.js → appListCommands-LKI2VES7.js} +39 -35
- package/{authCommand-T7UK4CWS.js → authCommand-AECKBG65.js} +21 -20
- package/{authCommands-EAPFGNHN.js → authCommands-W74NRPA6.js} +6 -6
- package/{chatQueueReduxAdapter-LVQXC4ZY.js → chatQueueReduxAdapter-WJXO2JCG.js} +23 -22
- package/{chunk-HDKRSRYU.js → chunk-326E2B5C.js} +289 -93
- package/{chunk-2UECQ7RE.js → chunk-3AOLVADY.js} +1 -1
- package/{chunk-M2YMQOLC.js → chunk-3CPL3LU2.js} +11 -11
- package/chunk-3Z32AD6X.js +22 -0
- package/{chunk-HUCT7HID.js → chunk-42IF53CR.js} +1 -1
- package/{chunk-5SBK2MTI.js → chunk-64M2WCLT.js} +23 -70
- package/{chunk-LOD75GOS.js → chunk-674FTH5U.js} +3751 -1557
- package/{chunk-AOXVOC6D.js → chunk-6O5DMZOS.js} +3 -3
- package/{chunk-GMXWYXAF.js → chunk-7AXGPKX5.js} +3 -3
- package/{chunk-FMEVI5TG.js → chunk-7CH6U3FL.js} +1 -1
- package/{chunk-OR2HNLVO.js → chunk-7EPNNOL4.js} +6 -6
- package/{chunk-DFUPZE6V.js → chunk-7SLMYTSF.js} +1 -1
- package/{chunk-BQXOGBFN.js → chunk-A2YCVTV6.js} +1 -1
- package/{chunk-UK5JGQVU.js → chunk-A3UZKNUI.js} +13 -18
- package/{chunk-3GZXL6FM.js → chunk-AOWETAXX.js} +1 -1
- package/{chunk-B2BSG6QQ.js → chunk-ASWSPCJH.js} +18 -18
- package/{chunk-CLP2K7U4.js → chunk-BP3FSWKY.js} +6 -6
- package/{chunk-IHEC7VBF.js → chunk-BW7JSRVT.js} +1 -1
- package/{chunk-AAGCMVFT.js → chunk-BYXLXABD.js} +495 -148
- package/{chunk-MPZJVZDC.js → chunk-CDSTQJIJ.js} +27 -27
- package/{chunk-2H3XIBY4.js → chunk-D2CTCWWG.js} +4 -82
- package/{chunk-OIQPORYI.js → chunk-ECHNSF4H.js} +178 -2
- package/{chunk-TFPUAELY.js → chunk-EIWIUEOH.js} +2 -2
- package/{chunk-JTSGWTYZ.js → chunk-EMKX4VZW.js} +2 -2
- package/{chunk-6HYVJV7B.js → chunk-ESHYE7WU.js} +2 -1
- package/{chunk-ZURFOV5J.js → chunk-FS5VNMPF.js} +3 -3
- package/{chunk-U4TRT5V4.js → chunk-GEPHJJW4.js} +1 -1
- package/{chunk-5CS33IBL.js → chunk-GKAQBXBO.js} +11 -12
- package/{chunk-M4NC7NF6.js → chunk-GMSUMWFO.js} +2 -2
- package/{chunk-JMPYDFHY.js → chunk-HLXJXFXN.js} +21 -8
- package/{chunk-I6N2UVVY.js → chunk-JZUS5GOM.js} +1 -1
- package/{chunk-RAZOLMJR.js → chunk-KVRWX6K7.js} +2 -2
- package/{chunk-VH2F7ZB6.js → chunk-L4O5JAIW.js} +1 -1
- package/{chunk-57QJXIB6.js → chunk-L7EJWFAP.js} +9 -9
- package/{chunk-DPMBNHOJ.js → chunk-LAZTMWIU.js} +1 -1
- package/{chunk-ADLYMQB6.js → chunk-MBUNBGBE.js} +127 -0
- package/{chunk-Q5ITEGIN.js → chunk-N4XRDM26.js} +1 -1
- package/{chunk-7E72JMBB.js → chunk-N543Q3VR.js} +57 -16
- package/{chunk-WHD6BG7M.js → chunk-NEG2ROC2.js} +45 -41
- package/{chunk-2IVEXF7P.js → chunk-NMB23CNE.js} +2 -9
- package/{chunk-XCCGU6QB.js → chunk-NQWDSCDT.js} +1 -1
- package/{chunk-FSSX3XRY.js → chunk-NTOLFNU3.js} +1 -1
- package/chunk-OH4Q4VVA.js +38 -0
- package/{chunk-37V5LNEQ.js → chunk-OOG3PQCH.js} +1 -1
- package/{chunk-3WXRAHCG.js → chunk-OPSKBBSX.js} +3 -3
- package/{chunk-AFV4FOT2.js → chunk-OQVRTSZ5.js} +4 -91
- package/{chunk-GTYM4HKV.js → chunk-OXLUSM42.js} +5 -5
- package/{chunk-YDTYDA5W.js → chunk-PAW3XFD3.js} +8 -6
- package/{chunk-PREQU5QV.js → chunk-PECRHVNK.js} +1 -1
- package/{chunk-O6GEBMIY.js → chunk-PVJS353C.js} +8861 -8608
- package/{chunk-JZPBVBIY.js → chunk-QTZD6HBK.js} +18 -8
- package/chunk-TVXJEOU2.js +78 -0
- package/{chunk-3VAQHAXT.js → chunk-UFMFWBSG.js} +26 -26
- package/{chunk-73GINUCW.js → chunk-UGWIRZO6.js} +129 -50
- package/{chunk-NUO3QFWD.js → chunk-UNHKVD2N.js} +1 -1
- package/{chunk-GE6IWA5N.js → chunk-UNZDCI3O.js} +126 -1
- package/chunk-UOLENXLQ.js +1132 -0
- package/{chunk-FXFGNOT2.js → chunk-VFVCYIRQ.js} +1 -1
- package/chunk-VIRTYWWE.js +97 -0
- package/{chunk-6SXC35F4.js → chunk-VMAK5YKS.js} +12 -12
- package/{chunk-ZJMME4DS.js → chunk-W6NT2FW3.js} +6 -6
- package/{chunk-2QTEYCR7.js → chunk-X65PIFJI.js} +17 -7
- package/{chunk-JZ5AMMXU.js → chunk-XBNLE3MR.js} +3 -3
- package/{chunk-WLH5BAKX.js → chunk-YYTTDOWA.js} +2 -2
- package/{chunk-X2DAEZ3X.js → chunk-ZFGAPMSF.js} +1 -1
- package/{chunk-IL545V3E.js → chunk-ZJVSRWOP.js} +7 -7
- package/{cliExecutor-DW3PHGEL.js → cliExecutor-BBUVQU4L.js} +2 -2
- package/{codingSkills-DY5MINPG.js → codingSkills-5VOV3JVB.js} +3 -3
- package/{createAgentAutomationAction-INQT23LX.js → createAgentAutomationAction-RMKFWLA3.js} +24 -23
- package/{createDialogAction-LDCPDI73.js → createDialogAction-BLNYPWJ6.js} +27 -26
- package/{createPageAction-5YXOG2M4.js → createPageAction-MSJTHWS7.js} +28 -27
- package/{dbSlice-3SD5L5H2.js → dbSlice-YBUD2NZB.js} +7 -7
- package/{deleteFile-XQXPBFFB.js → deleteFile-74VF4EAJ.js} +4 -4
- package/{dialogCommands-CHJO47AX.js → dialogCommands-JI6X34PB.js} +38 -34
- package/{dialogSlice-DOWKOILN.js → dialogSlice-MJAX2T2X.js} +23 -22
- package/{docCreateCommands-OVZARUFX.js → docCreateCommands-KNLITDCK.js} +40 -36
- package/{docDeleteCommands-E2XJ62LD.js → docDeleteCommands-6SBOU75S.js} +41 -37
- package/{docReadCommands-I7OSREPJ.js → docReadCommands-NX77P5X4.js} +40 -36
- package/{docStore-UAWSKZ2Y.js → docStore-472FHNNN.js} +25 -24
- package/{docUpdateCommands-X4Z26VJM.js → docUpdateCommands-IHWNHH4O.js} +43 -39
- package/emscripten-module-EDQBMDVK.js +576 -0
- package/emscripten-module-LCBQ7VWY.js +1506 -0
- package/emscripten-module-OFHQ7EL3.js +482 -0
- package/emscripten-module-XM7NDJQA.js +4536 -0
- package/fetchMessages-7QRCCRYK.js +1 -1
- package/ffi-6ZSX3QJ4.js +80 -0
- package/ffi-742Y76PE.js +92 -0
- package/ffi-AEYWSYLM.js +80 -0
- package/ffi-KQC27OUM.js +92 -0
- package/{getPricing-L2ENXWHV.js → getPricing-J4VXWR5B.js} +4 -4
- package/{handleSendMessageAction-C3TSDWKH.js → handleSendMessageAction-V3SKWOOV.js} +26 -25
- package/index.js +78 -74
- package/{localRuntimeAuthority-E3R24J4T.js → localRuntimeAuthority-S77B5QVB.js} +6 -2
- package/{localRuntimeDb-DDZCJFQZ.js → localRuntimeDb-N3H3HQ7G.js} +1 -1
- package/{machineCommands-BUOIYJAD.js → machineCommands-ZDULQKUU.js} +80 -76
- package/{machineInfo-M6KB6HZN.js → machineInfo-66ZFUMLE.js} +1 -1
- package/{machineWsRunDispatch-7CRWAA6O.js → machineWsRunDispatch-XX2LNRJT.js} +68 -64
- package/{models-OX2S5C6Q.js → models-FM7YJ47W.js} +2 -2
- package/module-ES6BEMUI-AFCVSBMS.js +14 -0
- package/module-asyncify-2EFITU5U-DEP2F2QP.js +9 -0
- package/package.json +1 -1
- package/{read-6G73BMEY.js → read-7SIURKBF.js} +5 -5
- package/{readDocTool-DK4EI2GA.js → readDocTool-NWQFQ4IG.js} +1 -1
- package/{readlineWorkspace-ZDWEASJV.js → readlineWorkspace-NXB4IBLM.js} +3886 -3344
- package/{removeDialogAgentAction-E7H557UO.js → removeDialogAgentAction-S3LYHK4M.js} +11 -11
- package/{runAgentClientLoop-U7HYA3O5.js → runAgentClientLoop-TNETRJFJ.js} +50 -49
- package/{runtimeDoctorCommands-KIKM6BIO.js → runtimeDoctorCommands-HT4O2PXL.js} +6 -6
- package/{setDialogExtraReferencesAction-RMMGBR5F.js → setDialogExtraReferencesAction-L5ET3HEX.js} +8 -8
- package/{setPrimaryDialogAgentAction-FWBKKLVA.js → setPrimaryDialogAgentAction-ZZJOZQEM.js} +11 -11
- package/{settingSlice-73PV4KG4.js → settingSlice-ZFOZPBI2.js} +9 -9
- package/{skillDiscovery-KLLKXPUO.js → skillDiscovery-6YSTRCQ7.js} +3 -3
- package/{spaceCommands-GEWZXGHM.js → spaceCommands-CAWUGXJS.js} +44 -40
- package/{spaceSlice-B6MOVY4N.js → spaceSlice-J5D3LTMO.js} +24 -23
- package/{streamAgentChatTurn-T527EQTT.js → streamAgentChatTurn-YI5O3T4X.js} +104 -114
- package/{switchDialogAgentAction-US6QNL3N.js → switchDialogAgentAction-ZWCYLWVK.js} +7 -7
- package/{tableCommands-QE47K72R.js → tableCommands-5OKD2DKN.js} +8 -8
- package/{tools-XMWCVMPM.js → tools-HI4U6J6S.js} +39 -38
- package/{tuiSummaryLlmCaller-NCAJSVSD.js → tuiSummaryLlmCaller-3RC6WWRV.js} +15 -14
- package/{updateCommands-AK2RDOFR.js → updateCommands-MNDUIKN7.js} +2 -2
- package/{updateDialogTitleAction-XPJZRJEL.js → updateDialogTitleAction-V5H4LWFR.js} +30 -29
- package/chunk-6PO2SYCS.js +0 -1800
- package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-OPIGFRDO.js} +2 -2
- package/{chunk-ZHYK3N56.js → chunk-G7HTVVFL.js} +3 -3
- package/{chunk-SAQQLJZ5.js → chunk-JDSUTNYY.js} +3 -3
- package/{chunk-X664KVEV.js → chunk-QM6EN2ES.js} +3 -3
- package/{offlineMarxistsAgentCommand-GEH6SNNA.js → offlineMarxistsAgentCommand-HDIQVGKN.js} +3 -3
|
@@ -32,10 +32,10 @@ import {
|
|
|
32
32
|
resolvePlatformAuthToken,
|
|
33
33
|
resolvePlatformServerUrl,
|
|
34
34
|
resolveProviderTransportDecision
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-OQVRTSZ5.js";
|
|
36
36
|
import {
|
|
37
37
|
clipCompactText
|
|
38
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-6O5DMZOS.js";
|
|
39
39
|
import {
|
|
40
40
|
isRecord
|
|
41
41
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
+
import {
|
|
2
|
+
loadFileFromIndexedDb,
|
|
3
|
+
removeAction,
|
|
4
|
+
saveFileToIndexedDb
|
|
5
|
+
} from "./chunk-A2YCVTV6.js";
|
|
1
6
|
import {
|
|
2
7
|
DataType,
|
|
3
8
|
fileKey,
|
|
4
9
|
getFileIdFromKey,
|
|
5
10
|
ulid
|
|
6
11
|
} from "./chunk-KMSZPTM6.js";
|
|
7
|
-
import {
|
|
8
|
-
loadFileFromIndexedDb,
|
|
9
|
-
removeAction,
|
|
10
|
-
saveFileToIndexedDb
|
|
11
|
-
} from "./chunk-BQXOGBFN.js";
|
|
12
12
|
import {
|
|
13
13
|
readAction,
|
|
14
14
|
readRequestManager,
|
|
15
15
|
resolveAgentReadServers
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-A3UZKNUI.js";
|
|
17
17
|
import {
|
|
18
18
|
asyncThunkCreator,
|
|
19
19
|
buildCreateSlice,
|
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
shouldReplaceLocalWithRemoteRecord,
|
|
34
34
|
shouldReplicateLocalRecord,
|
|
35
35
|
uploadToCurrentServer
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-QM6EN2ES.js";
|
|
37
37
|
import {
|
|
38
38
|
fetchFromClientDb,
|
|
39
39
|
fetchFromServer,
|
|
@@ -707,7 +707,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
707
707
|
// 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
|
|
708
708
|
read: create.asyncThunk(
|
|
709
709
|
async (payload, thunkApi) => {
|
|
710
|
-
const { readAction: readAction2 } = await import("./read-
|
|
710
|
+
const { readAction: readAction2 } = await import("./read-7SIURKBF.js");
|
|
711
711
|
return readAction2(payload, thunkApi);
|
|
712
712
|
},
|
|
713
713
|
{
|
|
@@ -781,7 +781,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
781
781
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
782
782
|
share: create.asyncThunk(
|
|
783
783
|
async (config, thunkApi) => {
|
|
784
|
-
const { shareResourceAction } = await import("./action-
|
|
784
|
+
const { shareResourceAction } = await import("./action-4KWNL4XI.js");
|
|
785
785
|
return shareResourceAction(config, thunkApi);
|
|
786
786
|
}
|
|
787
787
|
),
|
|
@@ -20,6 +20,128 @@ import {
|
|
|
20
20
|
asOptionalTrimmedString
|
|
21
21
|
} from "./chunk-G3SUCT4W.js";
|
|
22
22
|
|
|
23
|
+
// packages/ai/tools/agent/quotaCircuitBreaker.ts
|
|
24
|
+
var QUOTA_ERROR_PATTERNS = [
|
|
25
|
+
/429/,
|
|
26
|
+
/quota/i,
|
|
27
|
+
/rate\s*limit/i,
|
|
28
|
+
/too\s*many\s*requests/i,
|
|
29
|
+
/额度/,
|
|
30
|
+
/上限/,
|
|
31
|
+
/用尽/,
|
|
32
|
+
/CliProviderQuotaError/i
|
|
33
|
+
];
|
|
34
|
+
function isCliProviderQuotaErrorShape(error) {
|
|
35
|
+
if (!error || typeof error !== "object") return false;
|
|
36
|
+
const e = error;
|
|
37
|
+
return e.name === "CliProviderQuotaError" || typeof e.message === "string" && e.message.startsWith("[QUOTA_LIMITED:");
|
|
38
|
+
}
|
|
39
|
+
function isQuotaExhaustedError(error) {
|
|
40
|
+
if (!error) return false;
|
|
41
|
+
if (isCliProviderQuotaErrorShape(error)) return true;
|
|
42
|
+
if (error instanceof Error) {
|
|
43
|
+
return QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(error.message));
|
|
44
|
+
}
|
|
45
|
+
if (typeof error === "string") {
|
|
46
|
+
return QUOTA_ERROR_PATTERNS.some((pattern) => pattern.test(error));
|
|
47
|
+
}
|
|
48
|
+
const maybeStatus = error.status;
|
|
49
|
+
if (typeof maybeStatus === "number" && maybeStatus === 429) return true;
|
|
50
|
+
const maybeStatusCode = error.statusCode;
|
|
51
|
+
if (typeof maybeStatusCode === "number" && maybeStatusCode === 429) return true;
|
|
52
|
+
return false;
|
|
53
|
+
}
|
|
54
|
+
function parseResetsInMs(text) {
|
|
55
|
+
if (!text) return void 0;
|
|
56
|
+
const unitMs = (n, unit) => {
|
|
57
|
+
if (/^d/.test(unit)) return n * 24 * 3600 * 1e3;
|
|
58
|
+
if (/^h/.test(unit)) return n * 3600 * 1e3;
|
|
59
|
+
if (/^m/.test(unit)) return n * 60 * 1e3;
|
|
60
|
+
if (/^s/.test(unit)) return n * 1e3;
|
|
61
|
+
return NaN;
|
|
62
|
+
};
|
|
63
|
+
const re = /(\d+)\s*(d(?:ay|ays)?|h(?:r|rs|our|ours)?|m(?:in|ins|inute|inutes)?|s(?:ec|ecs|econd|econds)?)/gi;
|
|
64
|
+
let totalMs = 0;
|
|
65
|
+
let matched = false;
|
|
66
|
+
let m;
|
|
67
|
+
while ((m = re.exec(text)) !== null) {
|
|
68
|
+
const ms = unitMs(Number(m[1]), m[2]);
|
|
69
|
+
if (!Number.isFinite(ms)) continue;
|
|
70
|
+
totalMs += ms;
|
|
71
|
+
matched = true;
|
|
72
|
+
}
|
|
73
|
+
return matched ? totalMs : void 0;
|
|
74
|
+
}
|
|
75
|
+
var DEFAULT_QUOTA_BREAKER_MS = 6 * 3600 * 1e3;
|
|
76
|
+
var DEFAULT_AGENT_NOT_FOUND_BREAKER_MS = 15 * 60 * 1e3;
|
|
77
|
+
|
|
78
|
+
// packages/ai/agent/agentAvailabilityShared.ts
|
|
79
|
+
var DEFAULT_PROVIDER_RETRY_MS = 5 * 60 * 1e3;
|
|
80
|
+
function isAgentUnavailableNow(agent, now = Date.now()) {
|
|
81
|
+
const at = agent?.nextAvailableAt;
|
|
82
|
+
return typeof at === "number" && Number.isFinite(at) && at > now;
|
|
83
|
+
}
|
|
84
|
+
function readRetryAfterTimestamp(body, now) {
|
|
85
|
+
if (!body || typeof body !== "object") return void 0;
|
|
86
|
+
const root = body;
|
|
87
|
+
const raw = root.retryAfter ?? root.retry_after ?? root["Retry-After"];
|
|
88
|
+
if (typeof raw === "number" && Number.isFinite(raw)) {
|
|
89
|
+
return raw > 1e12 ? raw : now + Math.max(0, raw) * 1e3;
|
|
90
|
+
}
|
|
91
|
+
if (typeof raw === "string") {
|
|
92
|
+
const seconds = Number(raw.trim());
|
|
93
|
+
if (Number.isFinite(seconds)) return now + Math.max(0, seconds) * 1e3;
|
|
94
|
+
const date = Date.parse(raw);
|
|
95
|
+
if (Number.isFinite(date)) return date;
|
|
96
|
+
}
|
|
97
|
+
return void 0;
|
|
98
|
+
}
|
|
99
|
+
function readResetTimestamp(body) {
|
|
100
|
+
if (!body || typeof body !== "object") return void 0;
|
|
101
|
+
const root = body;
|
|
102
|
+
const error = root.error && typeof root.error === "object" ? root.error : root;
|
|
103
|
+
const details = error.details && typeof error.details === "object" ? error.details : void 0;
|
|
104
|
+
const raw = error.resets_at ?? error.resetsAt ?? details?.resets_at ?? details?.resetsAt;
|
|
105
|
+
if (typeof raw === "number" && Number.isFinite(raw)) {
|
|
106
|
+
return raw > 1e12 ? raw : raw * 1e3;
|
|
107
|
+
}
|
|
108
|
+
if (typeof raw === "string") {
|
|
109
|
+
const parsed = Date.parse(raw);
|
|
110
|
+
if (Number.isFinite(parsed)) return parsed;
|
|
111
|
+
}
|
|
112
|
+
return void 0;
|
|
113
|
+
}
|
|
114
|
+
function parseResetAtText(value, now) {
|
|
115
|
+
const m = value.match(
|
|
116
|
+
/resets?\s+at\s+(\d{4}-\d{2}-\d{2}(?:[T ]\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?(?:Z|[+-]\d{2}:?\d{2})?)?)/i
|
|
117
|
+
);
|
|
118
|
+
if (!m?.[1]) return void 0;
|
|
119
|
+
const parsed = Date.parse(m[1]);
|
|
120
|
+
return Number.isFinite(parsed) && parsed > now ? parsed : void 0;
|
|
121
|
+
}
|
|
122
|
+
function resolveNextAvailableAt(body, now, headers) {
|
|
123
|
+
const headerRetryAfter = headers && typeof headers.get === "function" ? headers.get("retry-after") : headers?.["retry-after"] ?? headers?.["Retry-After"];
|
|
124
|
+
const retryAfter = headerRetryAfter ? readRetryAfterTimestamp({ retryAfter: headerRetryAfter }, now) : readRetryAfterTimestamp(body, now);
|
|
125
|
+
if (retryAfter !== void 0 && retryAfter > now) return retryAfter;
|
|
126
|
+
const absolute = readResetTimestamp(body);
|
|
127
|
+
if (absolute !== void 0 && absolute > now) return absolute;
|
|
128
|
+
const text = typeof body === "string" ? body : JSON.stringify(body ?? "");
|
|
129
|
+
return parseResetAtText(text, now) ?? now + (parseResetsInMs(text) ?? DEFAULT_PROVIDER_RETRY_MS);
|
|
130
|
+
}
|
|
131
|
+
function resolveAvailabilityAction(status, body, now, headers) {
|
|
132
|
+
if (status >= 200 && status < 300) return { kind: "clear" };
|
|
133
|
+
if (status === 429) {
|
|
134
|
+
return { kind: "mark", nextAvailableAt: resolveNextAvailableAt(body, now, headers) };
|
|
135
|
+
}
|
|
136
|
+
if (status >= 500) {
|
|
137
|
+
return { kind: "mark", nextAvailableAt: now + DEFAULT_PROVIDER_RETRY_MS };
|
|
138
|
+
}
|
|
139
|
+
return { kind: "noop" };
|
|
140
|
+
}
|
|
141
|
+
function mergeAvailabilityDeadline(currentDeadline, nextAvailableAt) {
|
|
142
|
+
return typeof currentDeadline === "number" && Number.isFinite(currentDeadline) ? Math.max(currentDeadline, nextAvailableAt) : nextAvailableAt;
|
|
143
|
+
}
|
|
144
|
+
|
|
23
145
|
// packages/agent-runtime/agentRecordKeys.ts
|
|
24
146
|
function buildAgentRuntimeAgentLookupKeys(args) {
|
|
25
147
|
if (/^agent(-pub)?-/.test(args.agentRef)) {
|
|
@@ -619,6 +741,11 @@ function buildNoloWorkspaceCommandArgs(call) {
|
|
|
619
741
|
}
|
|
620
742
|
|
|
621
743
|
export {
|
|
744
|
+
QUOTA_ERROR_PATTERNS,
|
|
745
|
+
isQuotaExhaustedError,
|
|
746
|
+
isAgentUnavailableNow,
|
|
747
|
+
resolveAvailabilityAction,
|
|
748
|
+
mergeAvailabilityDeadline,
|
|
622
749
|
buildAgentRuntimeAgentLookupKeys,
|
|
623
750
|
shouldFetchAgentRuntimeRecordRemotely,
|
|
624
751
|
resolveRuntimeToolSurfaceForAgent,
|
|
@@ -14,7 +14,7 @@ function buildCliLocalRuntimeDbEnv(env = process.env) {
|
|
|
14
14
|
};
|
|
15
15
|
}
|
|
16
16
|
async function getDefaultCliLocalRuntimeDb(options = {}) {
|
|
17
|
-
const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-
|
|
17
|
+
const { getDefaultCliLocalRuntimeDb: getAuthorityBackedDb } = await import("./localRuntimeAuthority-S77B5QVB.js");
|
|
18
18
|
return getAuthorityBackedDb(options);
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveMachineId
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ESHYE7WU.js";
|
|
4
4
|
import {
|
|
5
5
|
getDefaultCliLocalRuntimeDb
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-N4XRDM26.js";
|
|
7
|
+
import {
|
|
8
|
+
createMemoryKey,
|
|
9
|
+
createMemoryOwnerIndexKey,
|
|
10
|
+
createMemorySubjectKindIndexKey,
|
|
11
|
+
memoryOwnerRange
|
|
12
|
+
} from "./chunk-KMSZPTM6.js";
|
|
13
|
+
import {
|
|
14
|
+
asTrimmedNonEmptyStringArray
|
|
15
|
+
} from "./chunk-I42VC5KR.js";
|
|
16
|
+
import {
|
|
17
|
+
asTrimmedString
|
|
18
|
+
} from "./chunk-3EUW3WEO.js";
|
|
7
19
|
import {
|
|
8
20
|
buildCliRuntimeEnv,
|
|
9
21
|
clearProfileAuthToken,
|
|
@@ -11,25 +23,13 @@ import {
|
|
|
11
23
|
getDefaultProfileConfigPath,
|
|
12
24
|
loadProfileConfig,
|
|
13
25
|
saveDefaultProfile
|
|
14
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-UNZDCI3O.js";
|
|
15
27
|
import {
|
|
16
28
|
resolveAuthTokenFromEnv
|
|
17
29
|
} from "./chunk-A7GB5UGH.js";
|
|
18
30
|
import {
|
|
19
31
|
DEFAULT_NOLO_SERVER_URL
|
|
20
32
|
} from "./chunk-OLZBQWZU.js";
|
|
21
|
-
import {
|
|
22
|
-
createMemoryKey,
|
|
23
|
-
createMemoryOwnerIndexKey,
|
|
24
|
-
createMemorySubjectKindIndexKey,
|
|
25
|
-
memoryOwnerRange
|
|
26
|
-
} from "./chunk-KMSZPTM6.js";
|
|
27
|
-
import {
|
|
28
|
-
asTrimmedNonEmptyStringArray
|
|
29
|
-
} from "./chunk-I42VC5KR.js";
|
|
30
|
-
import {
|
|
31
|
-
asTrimmedString
|
|
32
|
-
} from "./chunk-3EUW3WEO.js";
|
|
33
33
|
import {
|
|
34
34
|
normalizeServerOrigin
|
|
35
35
|
} from "./chunk-CF7PE763.js";
|
|
@@ -40,6 +40,20 @@ import { stdin as input, stdout as output } from "node:process";
|
|
|
40
40
|
import { spawn } from "node:child_process";
|
|
41
41
|
|
|
42
42
|
// packages/ai/memory/delete.ts
|
|
43
|
+
function hasExplicitDeleteFilters(filters) {
|
|
44
|
+
return Boolean(
|
|
45
|
+
filters.ids && filters.ids.length > 0 || typeof filters.contentSubstring === "string" && filters.contentSubstring.trim().length > 0 || filters.tags && filters.tags.length > 0 || typeof filters.sourceDialogId === "string" && filters.sourceDialogId.trim().length > 0 || typeof filters.patternKeyPrefix === "string" && filters.patternKeyPrefix.trim().length > 0 || filters.facets && filters.facets.length > 0 || typeof filters.subjectId === "string" && filters.subjectId.trim().length > 0
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
function generateMemoryDeletionToken(ownerId, itemIds) {
|
|
49
|
+
const sorted = [...itemIds].sort().join(",");
|
|
50
|
+
const seed = `${ownerId}:${sorted}`;
|
|
51
|
+
let hash = 0;
|
|
52
|
+
for (let i = 0; i < seed.length; i++) {
|
|
53
|
+
hash = (hash << 5) - hash + seed.charCodeAt(i) | 0;
|
|
54
|
+
}
|
|
55
|
+
return `tok-${Math.abs(hash).toString(36)}-${itemIds.length}`;
|
|
56
|
+
}
|
|
43
57
|
var normalizeSet = (values) => {
|
|
44
58
|
if (!Array.isArray(values) || values.length === 0) return null;
|
|
45
59
|
const normalized = asTrimmedNonEmptyStringArray(values);
|
|
@@ -66,6 +80,10 @@ var matchesFilters = (item, filters) => {
|
|
|
66
80
|
if (!itemTags.has(tag)) return false;
|
|
67
81
|
}
|
|
68
82
|
}
|
|
83
|
+
const contentSub = asTrimmedString(filters.contentSubstring);
|
|
84
|
+
if (contentSub && !(item.content ?? "").toLowerCase().includes(contentSub.toLowerCase())) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
69
87
|
return true;
|
|
70
88
|
};
|
|
71
89
|
var deleteMemoryItemWithIndexesInBatch = (batch, item) => {
|
|
@@ -89,6 +107,11 @@ var deleteMemoryItemWithIndexesInBatch = (batch, item) => {
|
|
|
89
107
|
);
|
|
90
108
|
};
|
|
91
109
|
var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
|
|
110
|
+
if (!hasExplicitDeleteFilters(filters)) {
|
|
111
|
+
throw new Error(
|
|
112
|
+
"At least one filter is required; delete operation will not delete all memory implicitly."
|
|
113
|
+
);
|
|
114
|
+
}
|
|
92
115
|
const range = memoryOwnerRange(owner.ownerType, owner.ownerId);
|
|
93
116
|
const matchedItems = [];
|
|
94
117
|
const limit = typeof filters.limit === "number" && filters.limit > 0 ? filters.limit : Number.POSITIVE_INFINITY;
|
|
@@ -108,6 +131,23 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
|
|
|
108
131
|
if (matchedItems.length === 0) {
|
|
109
132
|
return { deletedCount: 0, deletedIds: [], matchedItems: [] };
|
|
110
133
|
}
|
|
134
|
+
const token = generateMemoryDeletionToken(
|
|
135
|
+
owner.ownerId,
|
|
136
|
+
matchedItems.map((i) => i.id)
|
|
137
|
+
);
|
|
138
|
+
if (filters.dryRun) {
|
|
139
|
+
return {
|
|
140
|
+
deletedCount: 0,
|
|
141
|
+
deletedIds: [],
|
|
142
|
+
matchedItems,
|
|
143
|
+
deletionToken: token
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
if (filters.deletionToken && filters.deletionToken !== token) {
|
|
147
|
+
throw new Error(
|
|
148
|
+
"deletionToken mismatch: memory dataset changed since preview; please rerun dry-run preview before confirming."
|
|
149
|
+
);
|
|
150
|
+
}
|
|
111
151
|
const batch = db.batch();
|
|
112
152
|
for (const item of matchedItems) {
|
|
113
153
|
deleteMemoryItemWithIndexesInBatch(batch, item);
|
|
@@ -116,7 +156,8 @@ var deleteMemoriesForOwnerFromDb = async (db, owner, filters = {}) => {
|
|
|
116
156
|
return {
|
|
117
157
|
deletedCount: matchedItems.length,
|
|
118
158
|
deletedIds: matchedItems.map((item) => item.id),
|
|
119
|
-
matchedItems
|
|
159
|
+
matchedItems,
|
|
160
|
+
deletionToken: token
|
|
120
161
|
};
|
|
121
162
|
};
|
|
122
163
|
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
ANTIGRAVITY_CLOUD_CODE_BASE_URL,
|
|
6
6
|
isAntigravityOAuthAgent
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LAZTMWIU.js";
|
|
8
8
|
import {
|
|
9
9
|
clipMultilineText,
|
|
10
10
|
fetchAndSerializeTable,
|
|
11
11
|
resolveBuiltinSkillPage,
|
|
12
12
|
waitForAbortableDelay
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-326E2B5C.js";
|
|
14
14
|
import {
|
|
15
15
|
createDrainExhaustedResponse,
|
|
16
16
|
isCoreDrainingBody,
|
|
@@ -20,19 +20,24 @@ import {
|
|
|
20
20
|
} from "./chunk-RQSOAMPJ.js";
|
|
21
21
|
import {
|
|
22
22
|
slateToSimplifiedMarkdown
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-OOG3PQCH.js";
|
|
24
24
|
import {
|
|
25
25
|
extractCategorizedMentions
|
|
26
26
|
} from "./chunk-GM6PU7B6.js";
|
|
27
27
|
import {
|
|
28
28
|
fetchAndCacheMessages
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-UGWIRZO6.js";
|
|
30
30
|
import {
|
|
31
31
|
shouldUseServerProxy
|
|
32
32
|
} from "./chunk-YYLHWIW6.js";
|
|
33
33
|
import {
|
|
34
34
|
fetchServerSyncedCredential
|
|
35
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-W6NT2FW3.js";
|
|
36
|
+
import {
|
|
37
|
+
buildSkillGuidancePromptBlock,
|
|
38
|
+
extractRuntimePageCapabilities,
|
|
39
|
+
resolveSkillGraphFromRoots
|
|
40
|
+
} from "./chunk-42IF53CR.js";
|
|
36
41
|
import {
|
|
37
42
|
buildCurrentTimeBlock,
|
|
38
43
|
buildIdentityBlock,
|
|
@@ -40,71 +45,68 @@ import {
|
|
|
40
45
|
requiresBareImageUrl,
|
|
41
46
|
resolveToolGuidedSections,
|
|
42
47
|
toBareImageUrlMessages
|
|
43
|
-
} from "./chunk-
|
|
48
|
+
} from "./chunk-64M2WCLT.js";
|
|
44
49
|
import {
|
|
45
50
|
convertMessagesToResponsesInput,
|
|
46
51
|
getUsageRequestOptions,
|
|
47
52
|
preserveAgentStateFields
|
|
48
53
|
} from "./chunk-NNWHHCVP.js";
|
|
49
54
|
import {
|
|
50
|
-
buildProviderAuthHeaders
|
|
55
|
+
buildProviderAuthHeaders
|
|
56
|
+
} from "./chunk-OQVRTSZ5.js";
|
|
57
|
+
import {
|
|
58
|
+
estimateTokenCount
|
|
59
|
+
} from "./chunk-6O5DMZOS.js";
|
|
60
|
+
import {
|
|
51
61
|
isOpenAiResponsesModel,
|
|
52
62
|
resolvePlatformChatCompletionsEndpoint,
|
|
53
63
|
resolvePlatformResponsesEndpoint
|
|
54
|
-
} from "./chunk-
|
|
64
|
+
} from "./chunk-VIRTYWWE.js";
|
|
55
65
|
import {
|
|
56
|
-
|
|
57
|
-
} from "./chunk-
|
|
66
|
+
createFileCredentialBroker
|
|
67
|
+
} from "./chunk-GKAQBXBO.js";
|
|
58
68
|
import {
|
|
59
69
|
clampReasoningEffort,
|
|
60
70
|
getModelConfig,
|
|
61
71
|
isModelSupportReasoningEffort
|
|
62
|
-
} from "./chunk-
|
|
72
|
+
} from "./chunk-7SLMYTSF.js";
|
|
63
73
|
import {
|
|
64
|
-
|
|
65
|
-
} from "./chunk-
|
|
74
|
+
createSpaceKey
|
|
75
|
+
} from "./chunk-EMKX4VZW.js";
|
|
76
|
+
import {
|
|
77
|
+
toErrorMessage
|
|
78
|
+
} from "./chunk-HNMXYYJR.js";
|
|
66
79
|
import {
|
|
67
80
|
MEMORY_USE_GUIDANCE,
|
|
68
81
|
buildUserResponseLanguageContext,
|
|
69
82
|
wrapHistoricalSummaryWithReplayGuard
|
|
70
|
-
} from "./chunk-
|
|
71
|
-
import {
|
|
72
|
-
buildSkillGuidancePromptBlock,
|
|
73
|
-
extractRuntimePageCapabilities,
|
|
74
|
-
resolveSkillGraphFromRoots
|
|
75
|
-
} from "./chunk-HUCT7HID.js";
|
|
83
|
+
} from "./chunk-7CH6U3FL.js";
|
|
76
84
|
import {
|
|
77
85
|
canonicalizeToolNames
|
|
78
86
|
} from "./chunk-ZZ2MH7LE.js";
|
|
79
|
-
import {
|
|
80
|
-
toErrorMessage
|
|
81
|
-
} from "./chunk-HNMXYYJR.js";
|
|
82
87
|
import {
|
|
83
88
|
isDeepInfraKimiModel,
|
|
84
89
|
isFireworksKimiModel,
|
|
85
90
|
resolveFireworksKimiModel
|
|
86
|
-
} from "./chunk-
|
|
87
|
-
import {
|
|
88
|
-
createSpaceKey
|
|
89
|
-
} from "./chunk-JTSGWTYZ.js";
|
|
91
|
+
} from "./chunk-7EPNNOL4.js";
|
|
90
92
|
import {
|
|
91
93
|
read
|
|
92
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-L7EJWFAP.js";
|
|
93
95
|
import {
|
|
94
96
|
asTrimmedLowercaseString
|
|
95
97
|
} from "./chunk-QSJ3HFEF.js";
|
|
98
|
+
import {
|
|
99
|
+
extractCustomId
|
|
100
|
+
} from "./chunk-BJIRLHJR.js";
|
|
96
101
|
import {
|
|
97
102
|
getRuntimeServerContext
|
|
98
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-QM6EN2ES.js";
|
|
99
104
|
import {
|
|
100
105
|
isAbortError
|
|
101
106
|
} from "./chunk-WJSW43QZ.js";
|
|
102
107
|
import {
|
|
103
108
|
asTrimmedString
|
|
104
109
|
} from "./chunk-3EUW3WEO.js";
|
|
105
|
-
import {
|
|
106
|
-
extractCustomId
|
|
107
|
-
} from "./chunk-BJIRLHJR.js";
|
|
108
110
|
import {
|
|
109
111
|
API_ENDPOINTS
|
|
110
112
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -555,16 +557,18 @@ ${description}
|
|
|
555
557
|
${content} ` : "";
|
|
556
558
|
var buildResponseGuidelines = (isMobile) => {
|
|
557
559
|
if (isMobile) {
|
|
558
|
-
return
|
|
559
|
-
\
|
|
560
|
-
- \
|
|
561
|
-
- \
|
|
562
|
-
- \
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
\
|
|
566
|
-
|
|
567
|
-
- \
|
|
560
|
+
return `--- \u54CD\u5E94\u5C55\u793A\u6307\u5357\uFF08\u7A84\u5C4F / TUI / \u79FB\u52A8\u7AEF\uFF09 ---
|
|
561
|
+
\u5F53\u524D\u5904\u4E8E\u7A84\u5C4F\u6216\u7EC8\u7AEF\u89C6\u56FE\uFF0C\u8BF7\u91C7\u7528\u7D27\u51D1\u3001\u9AD8\u626B\u63CF\u7387\u7684\u6392\u7248\uFF1A
|
|
562
|
+
- \u3010\u7ED3\u6784\u8282\u594F\u3011\u7ED3\u8BBA\u6216\u5173\u952E\u72B6\u6001\u7F6E\u9876\uFF0C\u62D2\u7EDD\u5BC6\u96C6\u957F\u6BB5\u843D\uFF1B\u6BCF\u6BB5\u4FDD\u6301 2-3 \u884C\uFF0C\u5584\u7528\u300C---\u300D\u6216\u5F15\u7528\u5757\u505A\u5361\u7247\u5316\u5207\u5206\u3002
|
|
563
|
+
- \u3010\u7B26\u53F7\u5C42\u7EA7\u3011\u7528\u660E\u786E\u89C6\u89C9\u951A\u70B9\uFF08\u5982 \u25B8\u3001\u2022\u30011.\u3001\u2714 / \u2718 / \u26A0\uFF09\u66FF\u4EE3\u5E73\u94FA\u53D9\u8FF0\uFF0C\u7F29\u8FDB\u4E0D\u8D85\u8FC7 2 \u5C42\u3002
|
|
564
|
+
- \u3010\u9632\u6298\u884C\u7834\u788E\u3011\u4E25\u7981\u4F7F\u7528 \u22654 \u5217\u7684\u5927\u5BBD\u8868\uFF08\u7EC8\u7AEF\u4E0B\u6298\u884C\u4F1A\u4E25\u91CD\u9519\u4F4D\uFF09\uFF0C\u6539\u7528\u300C\u952E\u503C\u6E05\u5355\u300D\u6216\u7EB5\u5411\u5361\u7247\uFF1B\u6587\u4EF6\u8DEF\u5F84\u3001\u547D\u4EE4\u53CA\u6807\u8BC6\u7B26\u4E00\u5F8B\u7528\u53CD\u5F15\u53F7 \` \` \u5305\u88F9\u4FDD\u62A4\u3002
|
|
565
|
+
- \u3010\u7D27\u51D1\u4EE3\u7801\u3011\u4EE3\u7801\u5757\u5C3D\u91CF\u53EA\u4FDD\u7559\u5173\u952E\u4E0A\u4E0B\u6587\u4E0E\u5FC5\u8981\u884C\uFF0C\u907F\u514D\u6A2A\u5411\u8D85\u957F\u884C\u3002`;
|
|
566
|
+
}
|
|
567
|
+
return `--- \u54CD\u5E94\u5C55\u793A\u6307\u5357\uFF08\u5BBD\u5C4F / \u684C\u9762\u7AEF\uFF09 ---
|
|
568
|
+
\u5F53\u524D\u5904\u4E8E\u5927\u5C4F\u89C6\u56FE\uFF0C\u53EF\u5145\u5206\u53D1\u6325\u7A7A\u95F4\u4F18\u52BF\uFF1A
|
|
569
|
+
- \u3010\u7ED3\u6784\u5316\u5168\u666F\u3011\u63D0\u4F9B\u5C42\u6B21\u6E05\u6670\u7684\u903B\u8F91\u6811\u3001\u6D41\u7A0B\u56FE\u6216\u7ED3\u6784\u5316\u63A8\u5BFC\uFF0C\u91CD\u8981\u6A21\u5757\u4F7F\u7528\u4E8C\u7EA7/\u4E09\u7EA7\u6807\u9898\u6E05\u6670\u5212\u5206\u3002
|
|
570
|
+
- \u3010\u5BF9\u6BD4\u4E0E\u8868\u683C\u3011\u9002\u5408\u4F7F\u7528 Markdown \u591A\u5217\u8868\u683C\u8FDB\u884C\u65B9\u6848\u6A2A\u5411\u5BF9\u6BD4\u3001\u53C2\u6570\u6C47\u603B\u6216\u77E9\u9635\u5206\u6790\u3002
|
|
571
|
+
- \u3010\u4EE3\u7801\u5B8C\u6574\u5EA6\u3011\u53EF\u5C55\u793A\u66F4\u5B8C\u6574\u7684\u6587\u4EF6\u4E0A\u4E0B\u6587\u3001\u7C7B\u578B\u5B9A\u4E49\u4E0E\u591A\u6B65\u6267\u884C\u793A\u4F8B\uFF0C\u914D\u5408\u6E05\u6670\u7684\u6CE8\u91CA\u8BF4\u660E\u3002`;
|
|
568
572
|
};
|
|
569
573
|
var buildReferenceMaterialsBlock = (contexts) => {
|
|
570
574
|
const sections = [
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./chunk-YYLHWIW6.js";
|
|
4
4
|
import {
|
|
5
5
|
getModelAbility
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-X65PIFJI.js";
|
|
7
7
|
import {
|
|
8
8
|
isOwnedAgentKey,
|
|
9
9
|
ownedAgentKey,
|
|
@@ -178,14 +178,7 @@ function sortSafeAgentSummaries(agents) {
|
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
|
|
181
|
-
// packages/ai/agent/agentAvailabilityShared.ts
|
|
182
|
-
function isAgentUnavailableNow(agent, now = Date.now()) {
|
|
183
|
-
const at = agent?.nextAvailableAt;
|
|
184
|
-
return typeof at === "number" && Number.isFinite(at) && at > now;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
181
|
export {
|
|
188
182
|
toSafeAgentSummary,
|
|
189
|
-
sortSafeAgentSummaries
|
|
190
|
-
isAgentUnavailableNow
|
|
183
|
+
sortSafeAgentSummaries
|
|
191
184
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// packages/agent-runtime/emptyAssistantRepair.ts
|
|
2
|
+
var EMPTY_ASSISTANT_REPAIR_PROMPT = "\u8BF7\u7ED9\u51FA\u660E\u786E\u7684\u6587\u5B57\u56DE\u7B54\u6216\u6267\u884C\u4E0B\u4E00\u6B65\uFF1A\u5982\u679C\u4EFB\u52A1\u5DF2\u5B8C\u6210\uFF0C\u8BF7\u76F4\u63A5\u603B\u7ED3\u7ED3\u679C\uFF1B\u5982\u679C\u9700\u8981\u8C03\u7528\u5DE5\u5177\uFF0C\u8BF7\u76F4\u63A5\u8F93\u51FA tool_calls\u3002\u8BF7\u5207\u52FF\u8FD4\u56DE\u7A7A\u5185\u5BB9\u3002";
|
|
3
|
+
var EMPTY_ASSISTANT_FALLBACK_MESSAGE = "\u6A21\u578B\u8FDE\u7EED\u8FD4\u56DE\u7A7A\u6D88\u606F\uFF0C\u5F53\u524D\u4EFB\u52A1\u672A\u5B8C\u6210\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\uFF0C\u6216\u7ED9\u51FA\u66F4\u5177\u4F53\u7684\u4FEE\u6539\u8303\u56F4\u3002";
|
|
4
|
+
var LENGTH_TRUNCATED_FALLBACK_MESSAGE = "\u8F93\u51FA\u8FBE\u5230\u957F\u5EA6\u4E0A\u9650\u88AB\u622A\u65AD\uFF0C\u5EFA\u8BAE\u7F29\u77ED\u4EFB\u52A1\u6216\u63D0\u9AD8\u8F93\u51FA\u4E0A\u9650\u3002";
|
|
5
|
+
var STREAM_TRUNCATED_FALLBACK_MESSAGE = "\u4E0A\u6E38\u54CD\u5E94\u6D41\u5728\u6536\u5C3E\u524D\u88AB\u4E2D\u65AD\uFF08\u672A\u6536\u5230\u7ED3\u675F\u6807\u8BB0\uFF09\uFF0C\u672C\u8F6E\u8F93\u51FA\u4E0D\u5B8C\u6574\u3002\u8BF7\u91CD\u8BD5\u5F53\u524D\u6B65\u9AA4\u3002";
|
|
6
|
+
function resolveEmptyAssistantOutcome(args) {
|
|
7
|
+
if (args.hasToolCalls || args.hasVisibleOutput) return { kind: "ok" };
|
|
8
|
+
if (args.finishReason === "length") return { kind: "fallback", reason: "length_truncated" };
|
|
9
|
+
if (!args.repairUsed) return { kind: "repair" };
|
|
10
|
+
if (!args.finishReason && !args.streamComplete) {
|
|
11
|
+
return { kind: "fallback", reason: "stream_truncated" };
|
|
12
|
+
}
|
|
13
|
+
return { kind: "fallback", reason: "empty_completion" };
|
|
14
|
+
}
|
|
15
|
+
function resolveEmptyAssistantFallbackMessage(reason) {
|
|
16
|
+
if (reason === "length_truncated") return LENGTH_TRUNCATED_FALLBACK_MESSAGE;
|
|
17
|
+
if (reason === "stream_truncated") return STREAM_TRUNCATED_FALLBACK_MESSAGE;
|
|
18
|
+
return EMPTY_ASSISTANT_FALLBACK_MESSAGE;
|
|
19
|
+
}
|
|
20
|
+
function hasAssistantVisibleOutput(content) {
|
|
21
|
+
if (typeof content === "string") return content.trim().length > 0;
|
|
22
|
+
if (!Array.isArray(content)) return false;
|
|
23
|
+
return content.some((part) => {
|
|
24
|
+
if (part?.type === "text" && String(part.text ?? "").trim()) return true;
|
|
25
|
+
if (part?.type === "image_url") {
|
|
26
|
+
const url = part?.image_url?.url;
|
|
27
|
+
return typeof url === "string" && url.trim().length > 0;
|
|
28
|
+
}
|
|
29
|
+
return false;
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export {
|
|
34
|
+
EMPTY_ASSISTANT_REPAIR_PROMPT,
|
|
35
|
+
resolveEmptyAssistantOutcome,
|
|
36
|
+
resolveEmptyAssistantFallbackMessage,
|
|
37
|
+
hasAssistantVisibleOutput
|
|
38
|
+
};
|
|
@@ -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-7SIURKBF.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,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
listUserRecordsFromServers,
|
|
3
3
|
readLiveDbRecordAfterTombstoneMerge
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BW7JSRVT.js";
|
|
5
5
|
import {
|
|
6
6
|
agentRecordHasConfiguredCredential
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-PAW3XFD3.js";
|
|
8
8
|
import {
|
|
9
9
|
toSafeAgentSummary
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-NMB23CNE.js";
|
|
11
11
|
import {
|
|
12
12
|
PUBLIC_AGENT_KEY_PREFIX,
|
|
13
13
|
isOwnedAgentKey,
|