nolo-cli 0.28.0 → 0.29.1
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-SUMILI7E.js → _executeModel-TN7FW73L.js} +21 -21
- package/{action-5MNAXR5B.js → action-6BM26ZYM.js} +4 -4
- package/{addContentAction-UNSYTVTB.js → addContentAction-HLTFX56O.js} +3 -3
- package/{addDialogAgentAction-LJGNP2AO.js → addDialogAgentAction-Q2TYWDO6.js} +2 -2
- package/{agentDeleteCommand-GEHAXWM6.js → agentDeleteCommand-VP4VLCMG.js} +10 -10
- package/{agentEmailCommands-PQXAKGK2.js → agentEmailCommands-N32KWVCX.js} +24 -24
- package/{agentListCommands-V2IIWNTX.js → agentListCommands-MXITEBUS.js} +12 -12
- package/{agentMachineCommands-Y47CABE2.js → agentMachineCommands-47Y2XEZZ.js} +10 -10
- package/{agentRecordCommands-UYUJUT4K.js → agentRecordCommands-AK6ZRJLD.js} +24 -24
- package/{agentRunCommand-3P6CCJQK.js → agentRunCommand-24SNVDNC.js} +24 -24
- package/{agentRuntimeLocal-ZALQDCZ3.js → agentRuntimeLocal-VI3NHLDU.js} +7 -7
- package/{agentSlice-LH2YKWE7.js → agentSlice-D666DABC.js} +3 -3
- package/{appDeleteCommands-XELAKISE.js → appDeleteCommands-SF2V6QYZ.js} +11 -11
- package/{appDeployCommands-PFHVHXJ3.js → appDeployCommands-3EPVR545.js} +11 -11
- package/{appDeployStatusCommands-RULB3DGE.js → appDeployStatusCommands-O65Y747J.js} +11 -11
- package/{appGetCommands-A3NLQ2U5.js → appGetCommands-AHDOF4SS.js} +11 -11
- package/{appListCommands-NQLJ7RHY.js → appListCommands-Y7YCXODU.js} +11 -11
- package/{chunk-XMAELUQW.js → chunk-2AX4ZWSG.js} +21 -21
- package/{chunk-7IX2Z2IF.js → chunk-33K2M3AU.js} +2 -2
- package/{chunk-54VHTARN.js → chunk-3LJ4RSSF.js} +1 -1
- package/{chunk-D36OKPFG.js → chunk-4MCHUZUI.js} +1 -1
- package/{chunk-IVMPWUAR.js → chunk-7CP4UOUV.js} +2 -2
- package/{chunk-I6RJGORZ.js → chunk-BOPFLKHA.js} +1 -1
- package/{chunk-7OYY7W4W.js → chunk-BPZSJH5X.js} +3 -3
- package/{chunk-OXLLFZNF.js → chunk-DBUNOYLF.js} +1 -1
- package/{chunk-S6KVFOUG.js → chunk-ENUJPSZN.js} +2 -2
- package/{chunk-D5D3XTWF.js → chunk-F7S2SH5C.js} +58 -20
- package/{chunk-MSXDPLDQ.js → chunk-FVY6KI5A.js} +1 -1
- package/{chunk-E4XWECLB.js → chunk-GFVFYNL7.js} +2 -2
- package/{chunk-4O2L6YR5.js → chunk-GVYU3EVI.js} +3 -3
- package/{chunk-7ZKK4F22.js → chunk-I5TJCJQP.js} +1 -1
- package/{chunk-ROJI6DRT.js → chunk-INWBJPQC.js} +2 -2
- package/{chunk-FON47ACC.js → chunk-JYSXE6LE.js} +3 -3
- package/{chunk-ATGTWONB.js → chunk-MHHYH3JA.js} +1 -1
- package/{chunk-SFFG3HJH.js → chunk-MUI34IA2.js} +4 -4
- package/{chunk-A6WDXLAG.js → chunk-P6TB7JIA.js} +158 -12
- package/{chunk-WCP5FDTF.js → chunk-PFTK5SEB.js} +21 -5
- package/{chunk-JQ3LNEMS.js → chunk-PMSG3OGF.js} +51 -4
- package/{chunk-QUXMWSCQ.js → chunk-RD6AOXQI.js} +22 -66
- package/{chunk-OMN2LILO.js → chunk-SNMJPH7J.js} +1 -1
- package/{chunk-UP7UFQOH.js → chunk-STOUEEBU.js} +1 -1
- package/{chunk-H7N2NOJF.js → chunk-STRCGEC6.js} +7 -4
- package/{chunk-HTLBU4ZY.js → chunk-WNENLKKI.js} +7 -7
- package/{chunk-MALVZUYL.js → chunk-WPRSBZYN.js} +1 -1
- package/{chunk-RRWRVIQU.js → chunk-XISENOC2.js} +1 -1
- package/{chunk-PASYOZYI.js → chunk-XMAMUPXU.js} +13 -11
- package/{chunk-BTA2CW6H.js → chunk-Y52E3TIS.js} +9 -9
- package/{chunk-MY54LNPC.js → chunk-YBHJZVWO.js} +3 -3
- package/{chunk-4UYKPT74.js → chunk-YRMUYZ5H.js} +2 -2
- package/{chunk-JMSCXQUG.js → chunk-Z3LLUGD5.js} +1 -1
- package/{createAgentAutomationAction-FAYQK5ME.js → createAgentAutomationAction-VK3N263U.js} +8 -8
- package/{createDialogAction-NDBK6IQG.js → createDialogAction-KWZ74S2G.js} +9 -9
- package/{createPageAction-CQTLV7FP.js → createPageAction-3CIZL5ZL.js} +8 -8
- package/{dbSlice-5BKDURDL.js → dbSlice-GOKRGQ47.js} +2 -2
- package/{dialogCommands-ZR42K2M5.js → dialogCommands-N4XKI6ZU.js} +11 -11
- package/{dialogSlice-ZLGEYKLO.js → dialogSlice-TKYB6VLO.js} +8 -8
- package/{docCreateCommands-2WXA3BCQ.js → docCreateCommands-DTDKANXX.js} +10 -10
- package/{docDeleteCommands-HSL7CD32.js → docDeleteCommands-U4NB6OHK.js} +11 -11
- package/{docReadCommands-YSPUU2DP.js → docReadCommands-SDVQM3BH.js} +10 -10
- package/{docStore-LJQIY2ZU.js → docStore-E5QAM75M.js} +9 -9
- package/{docUpdateCommands-EFYOIVM7.js → docUpdateCommands-O2O644FV.js} +10 -10
- package/{handleSendMessageAction-JL6GGVNW.js → handleSendMessageAction-7OVC2SVU.js} +8 -8
- package/index.js +40 -40
- package/{machineCommands-VAANUFNC.js → machineCommands-6GNFKAVC.js} +23 -23
- package/{machineWsRunDispatch-ABWV2WZO.js → machineWsRunDispatch-2DCHVG3U.js} +23 -23
- package/package.json +1 -1
- package/{read-F3L3T2WJ.js → read-A23NKT3O.js} +1 -1
- package/{readDocTool-FOHWVA4R.js → readDocTool-JAM5BI5Q.js} +1 -1
- package/{readlineWorkspace-GQI3XP5E.js → readlineWorkspace-KELDMUNZ.js} +27 -27
- package/{removeDialogAgentAction-QCFGIUIH.js → removeDialogAgentAction-K4HOWFHO.js} +4 -4
- package/{runAgentClientLoop-U632N2KO.js → runAgentClientLoop-R3S7YN6Z.js} +18 -18
- package/{setDialogExtraReferencesAction-DK4CKERU.js → setDialogExtraReferencesAction-JD7J7JM4.js} +3 -3
- package/{setPrimaryDialogAgentAction-SJSO6N27.js → setPrimaryDialogAgentAction-YWSA5XEU.js} +4 -4
- package/{settingSlice-XNM5AFPU.js → settingSlice-22GTX6CA.js} +3 -3
- package/{spaceCommands-DE6KNJIV.js → spaceCommands-WM6W3WMQ.js} +10 -10
- package/{spaceSlice-QTMWWQHQ.js → spaceSlice-RC2APBOD.js} +8 -8
- package/{streamAgentChatTurn-VU7BM3K3.js → streamAgentChatTurn-Q655CCVP.js} +77 -33
- package/{switchDialogAgentAction-4OAC6QRN.js → switchDialogAgentAction-6JKFBJVR.js} +2 -2
- package/{tools-LSIS6NY6.js → tools-A6MUIA3Q.js} +16 -16
- package/{updateDialogTitleAction-T77A54DE.js → updateDialogTitleAction-DQYY564Y.js} +8 -8
- package/{chunk-ATWUOTJP.js → chunk-NWT2WUCY.js} +1 -1
|
@@ -19,7 +19,7 @@ import {
|
|
|
19
19
|
parseAgentRunEvent,
|
|
20
20
|
t,
|
|
21
21
|
toolLabel
|
|
22
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-XMAMUPXU.js";
|
|
23
23
|
import {
|
|
24
24
|
getReadableCliDb
|
|
25
25
|
} from "./chunk-WFHXMLHZ.js";
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
normalizeAgentHandle,
|
|
28
28
|
readDbRecord,
|
|
29
29
|
resolveAgentRecordFromHybridStore
|
|
30
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-I5TJCJQP.js";
|
|
31
31
|
import {
|
|
32
32
|
NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
33
33
|
isLocalCliAgentKey
|
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
} from "./chunk-LTRXGFMS.js";
|
|
39
39
|
import {
|
|
40
40
|
formatAgentListCard
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-2AX4ZWSG.js";
|
|
42
42
|
import {
|
|
43
43
|
isGatewayHttpStatus
|
|
44
44
|
} from "./chunk-RQSOAMPJ.js";
|
|
@@ -50,12 +50,12 @@ import {
|
|
|
50
50
|
chooseMemoryOwners,
|
|
51
51
|
loadMemoryCandidatesFromDb,
|
|
52
52
|
resolveAgentMemoryPolicy
|
|
53
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-7CP4UOUV.js";
|
|
54
54
|
import {
|
|
55
55
|
API_REPORTED_COST_MULTIPLIER,
|
|
56
56
|
normalizeUsage,
|
|
57
57
|
parseUiAskChoiceContent
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-RD6AOXQI.js";
|
|
59
59
|
import {
|
|
60
60
|
buildSkillDiscoveryContextLayer
|
|
61
61
|
} from "./chunk-ZVZMT3EA.js";
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
LOCAL_TURN_ABORTED_CODE,
|
|
72
72
|
readActionGate,
|
|
73
73
|
readCommandActionGatePayload
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-P6TB7JIA.js";
|
|
75
75
|
import {
|
|
76
76
|
createThinkParserState,
|
|
77
77
|
flushThinkParser,
|
|
@@ -83,7 +83,7 @@ import {
|
|
|
83
83
|
import {
|
|
84
84
|
DEFAULT_CONTEXT_WINDOW,
|
|
85
85
|
getModelContextWindow
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-PMSG3OGF.js";
|
|
87
87
|
import {
|
|
88
88
|
clipCompactText
|
|
89
89
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -141,7 +141,7 @@ import {
|
|
|
141
141
|
BUILTIN_NOLO_AGENT_KEY,
|
|
142
142
|
PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
|
|
143
143
|
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY
|
|
144
|
-
} from "./chunk-
|
|
144
|
+
} from "./chunk-NWT2WUCY.js";
|
|
145
145
|
import {
|
|
146
146
|
asTrimmedString
|
|
147
147
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -3483,7 +3483,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
3483
3483
|
// packages/cli/client/agentRun.ts
|
|
3484
3484
|
import { ulid } from "ulid";
|
|
3485
3485
|
async function loadRunLocalAgentTurn() {
|
|
3486
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
3486
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-VI3NHLDU.js");
|
|
3487
3487
|
return runLocalAgentTurn;
|
|
3488
3488
|
}
|
|
3489
3489
|
async function resolveCurrentMachineId(options) {
|
|
@@ -3650,16 +3650,28 @@ function isMissingLocalAgentConfigError(error, agentRef) {
|
|
|
3650
3650
|
error && typeof error === "object" && "code" in error && error.code === LOCAL_AGENT_CONFIG_MISSING_CODE && error.agentRef === agentRef
|
|
3651
3651
|
);
|
|
3652
3652
|
}
|
|
3653
|
-
var
|
|
3653
|
+
var PROVIDER_HTTP_FAILED_RE = /(.+?) provider failed:\s*HTTP\s+(\d+)\b/i;
|
|
3654
|
+
var PLATFORM_TRANSPORT_RE = /\bplatform provider failed\b/i;
|
|
3654
3655
|
function classifyLocalRunError(message) {
|
|
3655
|
-
const m = message.match(
|
|
3656
|
+
const m = message.match(PROVIDER_HTTP_FAILED_RE);
|
|
3656
3657
|
if (!m) return { kind: "generic" };
|
|
3657
|
-
const status = Number(m[
|
|
3658
|
+
const status = Number(m[2]);
|
|
3659
|
+
const transport = PLATFORM_TRANSPORT_RE.test(message) ? "platform" : "local";
|
|
3660
|
+
if (status === 401 || status === 403) {
|
|
3661
|
+
return { kind: "auth", transport, status };
|
|
3662
|
+
}
|
|
3663
|
+
if (status === 400 || status === 422) {
|
|
3664
|
+
return { kind: "rejected-payload", transport, status };
|
|
3665
|
+
}
|
|
3666
|
+
if (status === 429) {
|
|
3667
|
+
return { kind: "rate-limit", transport, status };
|
|
3668
|
+
}
|
|
3658
3669
|
if (status >= 500 && status <= 599) {
|
|
3659
|
-
return { kind: "
|
|
3670
|
+
return { kind: "transient", transport, status };
|
|
3660
3671
|
}
|
|
3661
|
-
return { kind: "
|
|
3672
|
+
return { kind: "upstream", transport, status };
|
|
3662
3673
|
}
|
|
3674
|
+
var HISTORY_REPLAY_REJECTION_RE = /invalid_request_error|invalid\s+tool\s+call\s+arguments?/i;
|
|
3663
3675
|
function describeLocalRunFailure(message) {
|
|
3664
3676
|
if (/UPSTREAM_402|Insufficient Balance|余额不足|insufficient\s+balance/i.test(
|
|
3665
3677
|
message
|
|
@@ -3668,16 +3680,36 @@ function describeLocalRunFailure(message) {
|
|
|
3668
3680
|
`;
|
|
3669
3681
|
}
|
|
3670
3682
|
const cls = classifyLocalRunError(message);
|
|
3671
|
-
if (cls.kind === "
|
|
3672
|
-
return `[nolo] auto runtime: local run unavailable (
|
|
3683
|
+
if (cls.kind === "generic") {
|
|
3684
|
+
return `[nolo] auto runtime: local run unavailable (${message}). Not falling back to server. Fix the local credential/config and retry, or use --server to run on the server explicitly.
|
|
3673
3685
|
`;
|
|
3674
3686
|
}
|
|
3675
|
-
|
|
3676
|
-
|
|
3687
|
+
const where = cls.transport === "platform" ? "server chat proxy" : "local provider";
|
|
3688
|
+
const detail = message ? ` Detail: ${message}` : "";
|
|
3689
|
+
switch (cls.kind) {
|
|
3690
|
+
case "auth":
|
|
3691
|
+
return cls.transport === "platform" ? `[nolo] auto runtime: local run unavailable (${where} returned HTTP ${cls.status}, auth rejected).${detail} Not falling back to server. Check the agent's provider/api-key settings on nolo.chat, or use --server to run on the server explicitly.
|
|
3692
|
+
` : `[nolo] auto runtime: local run unavailable (${where} returned HTTP ${cls.status}, auth rejected).${detail} Not falling back to server. Fix the local credential/config and retry, or use --server to run on the server explicitly.
|
|
3677
3693
|
`;
|
|
3678
|
-
|
|
3679
|
-
|
|
3694
|
+
case "rejected-payload": {
|
|
3695
|
+
const looksLikeHistoryReplay = HISTORY_REPLAY_REJECTION_RE.test(message);
|
|
3696
|
+
const cause = looksLikeHistoryReplay ? ` This usually happens when the dialog history contains tool_calls or reasoning produced by a different model/provider (e.g. after /switch); the new provider rejects that history. Start a fresh dialog, or clean the offending history.` : "";
|
|
3697
|
+
return `[nolo] auto runtime: local run unavailable (${where} returned HTTP ${cls.status}, the provider rejected the request body \u2014 this is NOT a local credential/config issue).${detail}${cause} Not falling back to server. Use --server to run on the server explicitly, or start a fresh dialog.
|
|
3698
|
+
`;
|
|
3699
|
+
}
|
|
3700
|
+
case "rate-limit":
|
|
3701
|
+
return `[nolo] auto runtime: local run unavailable (${where} returned HTTP ${cls.status}, rate limited).${detail} Not falling back to server. Retry shortly, or use --server to run on the server explicitly.
|
|
3702
|
+
`;
|
|
3703
|
+
case "transient":
|
|
3704
|
+
return `[nolo] auto runtime: local run unavailable (${where} returned HTTP ${cls.status}; this is an upstream/gateway issue, not your local credential or config).${detail} Not falling back to server. Retry shortly, or use --server to run on the server explicitly.
|
|
3680
3705
|
`;
|
|
3706
|
+
case "upstream":
|
|
3707
|
+
default: {
|
|
3708
|
+
return cls.transport === "platform" ? `[nolo] auto runtime: local run unavailable (${where} returned HTTP ${cls.status}).${detail} Not falling back to server. Check the agent's provider/api-key settings on nolo.chat, or use --server to run on the server explicitly.
|
|
3709
|
+
` : `[nolo] auto runtime: local run unavailable (${where} returned HTTP ${cls.status}).${detail} Not falling back to server. Check the agent's endpoint/model settings, or use --server to run on the server explicitly.
|
|
3710
|
+
`;
|
|
3711
|
+
}
|
|
3712
|
+
}
|
|
3681
3713
|
}
|
|
3682
3714
|
function shouldAttemptAutoLocal(options) {
|
|
3683
3715
|
if (options.localRuntimeAdapter || options.localRuntimeAdapterFactory)
|
|
@@ -3969,6 +4001,12 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
3969
4001
|
"[nolo] \u5F53\u524D agent \u4E0D\u652F\u6301\u56FE\u7247\u8F93\u5165\uFF0C\u5DF2\u7528\u5360\u4F4D\u6587\u672C\u66FF\u4EE3\u3002\u8981\u5B8C\u6574\u56FE\u7247\u7406\u89E3\u53EF /switch \u5230 Kimi K2.6\u3002\n"
|
|
3970
4002
|
);
|
|
3971
4003
|
}
|
|
4004
|
+
if (event.kind === "image-preprocessed") {
|
|
4005
|
+
options.output.write(
|
|
4006
|
+
`[nolo] \u5DF2\u7528\u89C6\u89C9\u6A21\u578B\u89E3\u6790 ${event.imageCount} \u5F20\u56FE\u7247\u4E3A\u6587\u5B57\u63CF\u8FF0\uFF0C\u4F9B\u5F53\u524D agent \u4F7F\u7528\u3002
|
|
4007
|
+
`
|
|
4008
|
+
);
|
|
4009
|
+
}
|
|
3972
4010
|
options.onLoopEvent?.(event);
|
|
3973
4011
|
},
|
|
3974
4012
|
...options.abortSignal ? { abortSignal: options.abortSignal } : {},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XMAMUPXU.js";
|
|
4
4
|
import {
|
|
5
5
|
getReadableCliDb
|
|
6
6
|
} from "./chunk-WFHXMLHZ.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveAgentRecordFromHybridStore,
|
|
13
13
|
sanitizeAgentRecordForCliOutput,
|
|
14
14
|
writeAgentRecord
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-I5TJCJQP.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-VHBWHNVT.js";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createCliLocalRuntimeAdapter,
|
|
3
3
|
summarizeEndpoint
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-XMAMUPXU.js";
|
|
5
5
|
import {
|
|
6
6
|
clipMultilineText
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-2AX4ZWSG.js";
|
|
8
8
|
import {
|
|
9
9
|
runLocalAgentTurn
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-P6TB7JIA.js";
|
|
11
11
|
import {
|
|
12
12
|
resolveLocalRuntimeEnvFromPolicy
|
|
13
13
|
} from "./chunk-5CS33IBL.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
readAction,
|
|
13
13
|
readRequestManager,
|
|
14
14
|
resolveAgentReadServers
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-NWT2WUCY.js";
|
|
16
16
|
import {
|
|
17
17
|
asyncThunkCreator,
|
|
18
18
|
buildCreateSlice,
|
|
@@ -704,7 +704,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
704
704
|
// 动态 import 在调用期解析,避开 TDZ/求值顺序问题(同下方 share)。
|
|
705
705
|
read: create.asyncThunk(
|
|
706
706
|
async (payload, thunkApi) => {
|
|
707
|
-
const { readAction: readAction2 } = await import("./read-
|
|
707
|
+
const { readAction: readAction2 } = await import("./read-A23NKT3O.js");
|
|
708
708
|
return readAction2(payload, thunkApi);
|
|
709
709
|
},
|
|
710
710
|
{
|
|
@@ -778,7 +778,7 @@ var dbSlice = createSliceWithThunks({
|
|
|
778
778
|
// 这里改成动态 import,运行期才解析,彻底断开这条边。
|
|
779
779
|
share: create.asyncThunk(
|
|
780
780
|
async (config, thunkApi) => {
|
|
781
|
-
const { shareResourceAction } = await import("./action-
|
|
781
|
+
const { shareResourceAction } = await import("./action-6BM26ZYM.js");
|
|
782
782
|
return shareResourceAction(config, thunkApi);
|
|
783
783
|
}
|
|
784
784
|
),
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
patch,
|
|
12
12
|
remove,
|
|
13
13
|
write
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JYSXE6LE.js";
|
|
15
15
|
import {
|
|
16
16
|
createAgentKey,
|
|
17
17
|
toTrimmedString
|
|
@@ -300,7 +300,7 @@ var slice = createSliceWithThunks({
|
|
|
300
300
|
const overrides = {};
|
|
301
301
|
if (args.systemPromptOverride !== void 0) overrides.prompt = args.systemPromptOverride;
|
|
302
302
|
if (args.toolsOverride !== void 0) overrides.tools = args.toolsOverride;
|
|
303
|
-
const { _executeModel } = await import("./_executeModel-
|
|
303
|
+
const { _executeModel } = await import("./_executeModel-TN7FW73L.js");
|
|
304
304
|
return _executeModel(
|
|
305
305
|
{
|
|
306
306
|
isStreaming: args.isStreaming ?? false,
|
|
@@ -321,7 +321,7 @@ var slice = createSliceWithThunks({
|
|
|
321
321
|
* - 循环直到无工具调用或触发其他运行时停止条件
|
|
322
322
|
*/
|
|
323
323
|
runAgent: create.asyncThunk(async (args, thunkApi) => {
|
|
324
|
-
const { runAgentClientLoop } = await import("./runAgentClientLoop-
|
|
324
|
+
const { runAgentClientLoop } = await import("./runAgentClientLoop-R3S7YN6Z.js");
|
|
325
325
|
const { content: loopContent, toolCallCount } = await runAgentClientLoop(
|
|
326
326
|
{
|
|
327
327
|
agentKey: args.agentKey,
|
|
@@ -337,7 +337,7 @@ var slice = createSliceWithThunks({
|
|
|
337
337
|
* 聊天轮次流式 Agent 调用
|
|
338
338
|
*/
|
|
339
339
|
streamAgentChatTurn: create.asyncThunk(async (args, thunkApi) => {
|
|
340
|
-
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-
|
|
340
|
+
const { streamAgentChatTurnHandler } = await import("./streamAgentChatTurn-Q655CCVP.js");
|
|
341
341
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
342
342
|
}),
|
|
343
343
|
/**
|
|
@@ -9,8 +9,9 @@ import {
|
|
|
9
9
|
getModelContextWindow,
|
|
10
10
|
planCompression,
|
|
11
11
|
planContextUsage,
|
|
12
|
+
resolveBuiltinPlatformAgentConfig,
|
|
12
13
|
serializeMessageContent
|
|
13
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PMSG3OGF.js";
|
|
14
15
|
import {
|
|
15
16
|
clipCompactText
|
|
16
17
|
} from "./chunk-5MMAK75Q.js";
|
|
@@ -28,12 +29,18 @@ import {
|
|
|
28
29
|
import {
|
|
29
30
|
toErrorMessage
|
|
30
31
|
} from "./chunk-HNMXYYJR.js";
|
|
32
|
+
import {
|
|
33
|
+
PLATFORM_HOSTED_KIMI_K26_MODEL
|
|
34
|
+
} from "./chunk-YTA2QOEE.js";
|
|
31
35
|
import {
|
|
32
36
|
asRecordOrEmpty
|
|
33
37
|
} from "./chunk-KX6YBIHG.js";
|
|
34
38
|
import {
|
|
35
39
|
asTrimmedLowercaseString
|
|
36
40
|
} from "./chunk-QSJ3HFEF.js";
|
|
41
|
+
import {
|
|
42
|
+
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY
|
|
43
|
+
} from "./chunk-NWT2WUCY.js";
|
|
37
44
|
import {
|
|
38
45
|
isRecord
|
|
39
46
|
} from "./chunk-KUG52IAP.js";
|
|
@@ -160,6 +167,118 @@ var resolveAgentImageInputSupport = (agent) => {
|
|
|
160
167
|
return true;
|
|
161
168
|
};
|
|
162
169
|
|
|
170
|
+
// packages/ai/agent/imagePreprocessing.ts
|
|
171
|
+
var DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY = PUBLIC_KIMI_K26_IMAGE_AGENT_KEY;
|
|
172
|
+
var DESCRIBE_IMAGE_PROMPT = "\u8BF7\u8BE6\u7EC6\u63CF\u8FF0\u8FD9\u5F20\u56FE\u7247\u7684\u5185\u5BB9\uFF0C\u5305\u62EC\u573A\u666F\u3001\u7269\u4F53\u3001\u6587\u5B57\u3001\u989C\u8272\u548C\u5E03\u5C40\u7B49\u5173\u952E\u4FE1\u606F\u3002";
|
|
173
|
+
function extractImageUrlsFromMessages(messages) {
|
|
174
|
+
const urls = [];
|
|
175
|
+
for (const msg of messages) {
|
|
176
|
+
if (!Array.isArray(msg.content)) continue;
|
|
177
|
+
for (const part of msg.content) {
|
|
178
|
+
if (part && typeof part === "object" && part.type === "image_url" && part.image_url && typeof part.image_url.url === "string" && part.image_url.url.trim()) {
|
|
179
|
+
urls.push(part.image_url.url);
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
return urls;
|
|
184
|
+
}
|
|
185
|
+
function hasImageInRuntimeMessages(messages) {
|
|
186
|
+
return extractImageUrlsFromMessages(messages).length > 0;
|
|
187
|
+
}
|
|
188
|
+
async function preprocessImagesForTextOnlyAgent(messages, describeImage) {
|
|
189
|
+
const imageUrls = extractImageUrlsFromMessages(messages);
|
|
190
|
+
if (imageUrls.length === 0) return messages;
|
|
191
|
+
const description = await describeImage(imageUrls);
|
|
192
|
+
if (description === null || !description.trim()) return messages;
|
|
193
|
+
const descriptionText = `[\u56FE\u7247\u63CF\u8FF0] ${description.trim()}`;
|
|
194
|
+
return messages.map((msg) => {
|
|
195
|
+
if (!Array.isArray(msg.content)) return msg;
|
|
196
|
+
const hasImage = msg.content.some((p) => p?.type === "image_url");
|
|
197
|
+
if (!hasImage) return msg;
|
|
198
|
+
const newContent = msg.content.map((part) => {
|
|
199
|
+
if (part && typeof part === "object" && part.type === "image_url") {
|
|
200
|
+
return { type: "text", text: descriptionText };
|
|
201
|
+
}
|
|
202
|
+
return part;
|
|
203
|
+
}).filter((p) => p !== null && p !== void 0);
|
|
204
|
+
return { ...msg, content: newContent };
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
async function describeImageWithLocalProvider(adapter, imageUrls, visionAgentConfig) {
|
|
208
|
+
if (imageUrls.length === 0) return null;
|
|
209
|
+
try {
|
|
210
|
+
const config = visionAgentConfig ?? resolveBuiltinPlatformAgentConfig(DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY);
|
|
211
|
+
if (!config) {
|
|
212
|
+
console.warn("[imagePreprocessing] vision agent config not found, skipping");
|
|
213
|
+
return null;
|
|
214
|
+
}
|
|
215
|
+
const visionProvider = await adapter.resolveProvider(config);
|
|
216
|
+
const contentParts = [
|
|
217
|
+
{ type: "text", text: DESCRIBE_IMAGE_PROMPT }
|
|
218
|
+
];
|
|
219
|
+
for (const url of imageUrls) {
|
|
220
|
+
contentParts.push({ type: "image_url", image_url: { url } });
|
|
221
|
+
}
|
|
222
|
+
const result = await visionProvider.complete(
|
|
223
|
+
[{ role: "user", content: contentParts }],
|
|
224
|
+
{ timeoutMs: 3e4 }
|
|
225
|
+
);
|
|
226
|
+
const text = result.content?.trim();
|
|
227
|
+
if (!text) return null;
|
|
228
|
+
return text;
|
|
229
|
+
} catch (error) {
|
|
230
|
+
console.warn("[imagePreprocessing] vision describe failed, will fallback:", error);
|
|
231
|
+
return null;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
async function describeImageViaServerProxy(serverUrl, authToken, imageUrls, visionAgentKey) {
|
|
235
|
+
if (imageUrls.length === 0) return null;
|
|
236
|
+
const agentKey = visionAgentKey ?? DEFAULT_IMAGE_PREPROCESSOR_AGENT_KEY;
|
|
237
|
+
const visionConfig = resolveBuiltinPlatformAgentConfig(agentKey);
|
|
238
|
+
const visionModel = visionConfig?.model ?? PLATFORM_HOSTED_KIMI_K26_MODEL;
|
|
239
|
+
const visionProvider = visionConfig?.provider ?? "nolo";
|
|
240
|
+
try {
|
|
241
|
+
const contentParts = [
|
|
242
|
+
{ type: "text", text: DESCRIBE_IMAGE_PROMPT }
|
|
243
|
+
];
|
|
244
|
+
for (const url of imageUrls) {
|
|
245
|
+
contentParts.push({ type: "image_url", image_url: { url } });
|
|
246
|
+
}
|
|
247
|
+
const payload = {
|
|
248
|
+
model: visionModel,
|
|
249
|
+
messages: [{ role: "user", content: contentParts }],
|
|
250
|
+
stream: false,
|
|
251
|
+
provider: visionProvider,
|
|
252
|
+
agentKey,
|
|
253
|
+
// server proxy 需要 url 字段,但 nolo 平台 agent 的上游由 server 端路由,
|
|
254
|
+
// 这里放一个占位 url,server 端会根据 provider/model 覆盖。
|
|
255
|
+
url: "https://api.ollama.com/v1/chat/completions"
|
|
256
|
+
};
|
|
257
|
+
const response = await fetch(`${serverUrl}/api/chat`, {
|
|
258
|
+
method: "POST",
|
|
259
|
+
headers: {
|
|
260
|
+
"Content-Type": "application/json",
|
|
261
|
+
Authorization: `Bearer ${authToken}`
|
|
262
|
+
},
|
|
263
|
+
body: JSON.stringify(payload),
|
|
264
|
+
signal: AbortSignal.timeout(3e4)
|
|
265
|
+
});
|
|
266
|
+
if (!response.ok) {
|
|
267
|
+
console.warn(`[imagePreprocessing] server proxy vision call failed: ${response.status}`);
|
|
268
|
+
return null;
|
|
269
|
+
}
|
|
270
|
+
const data = await response.json();
|
|
271
|
+
const text = data?.choices?.[0]?.message?.content;
|
|
272
|
+
if (typeof text === "string" && text.trim()) {
|
|
273
|
+
return text.trim();
|
|
274
|
+
}
|
|
275
|
+
return null;
|
|
276
|
+
} catch (error) {
|
|
277
|
+
console.warn("[imagePreprocessing] server proxy vision describe failed:", error);
|
|
278
|
+
return null;
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
163
282
|
// packages/agent-runtime/toolCallPairing.ts
|
|
164
283
|
function readToolCallId(message) {
|
|
165
284
|
if (typeof message.tool_call_id === "string" && message.tool_call_id) {
|
|
@@ -1348,17 +1467,42 @@ async function runLocalAgentTurn(input) {
|
|
|
1348
1467
|
partialContent = "";
|
|
1349
1468
|
throwIfAborted(input);
|
|
1350
1469
|
const preparedMessages = prepareMessagesForProviderCall(messages);
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1470
|
+
let baseRequestMessages;
|
|
1471
|
+
if (!supportsImages && hasImageInRuntimeMessages(preparedMessages.messages)) {
|
|
1472
|
+
const imageUrls = extractImageUrlsFromMessages(preparedMessages.messages);
|
|
1473
|
+
const preprocessed = await preprocessImagesForTextOnlyAgent(
|
|
1474
|
+
preparedMessages.messages,
|
|
1475
|
+
(urls) => describeImageWithLocalProvider(input.adapter, urls)
|
|
1476
|
+
);
|
|
1477
|
+
if (preprocessed !== preparedMessages.messages) {
|
|
1478
|
+
baseRequestMessages = preprocessed;
|
|
1479
|
+
if (!imageDowngradeNotified) {
|
|
1480
|
+
imageDowngradeNotified = true;
|
|
1481
|
+
emitLoopEvent(input, {
|
|
1482
|
+
kind: "image-preprocessed",
|
|
1483
|
+
atMs: Date.now(),
|
|
1484
|
+
imageCount: imageUrls.length
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
} else {
|
|
1488
|
+
baseRequestMessages = filterImagePartsFromMessages(
|
|
1489
|
+
preparedMessages.messages,
|
|
1490
|
+
supportsImages
|
|
1491
|
+
);
|
|
1492
|
+
if (!imageDowngradeNotified) {
|
|
1493
|
+
imageDowngradeNotified = true;
|
|
1494
|
+
emitLoopEvent(input, {
|
|
1495
|
+
kind: "image-downgraded",
|
|
1496
|
+
reason: "no-vision",
|
|
1497
|
+
atMs: Date.now()
|
|
1498
|
+
});
|
|
1499
|
+
}
|
|
1500
|
+
}
|
|
1501
|
+
} else {
|
|
1502
|
+
baseRequestMessages = filterImagePartsFromMessages(
|
|
1503
|
+
preparedMessages.messages,
|
|
1504
|
+
supportsImages
|
|
1505
|
+
);
|
|
1362
1506
|
}
|
|
1363
1507
|
const requestMessages = emptyAssistantRepairPending ? [...baseRequestMessages, { role: "user", content: EMPTY_ASSISTANT_REPAIR_PROMPT }] : baseRequestMessages;
|
|
1364
1508
|
const contextMetrics = {
|
|
@@ -1636,6 +1780,8 @@ export {
|
|
|
1636
1780
|
parseToolArgumentsJson,
|
|
1637
1781
|
summarizeToolArguments,
|
|
1638
1782
|
resolveAgentImageInputSupport,
|
|
1783
|
+
preprocessImagesForTextOnlyAgent,
|
|
1784
|
+
describeImageViaServerProxy,
|
|
1639
1785
|
resolveHistoricalToolContentCap,
|
|
1640
1786
|
projectToolMessageContent,
|
|
1641
1787
|
LOCAL_AGENT_CONFIG_MISSING_CODE,
|
|
@@ -173,9 +173,16 @@ function buildNoloWorkspaceOpenAiTools(args) {
|
|
|
173
173
|
limit: { type: "integer", description: "Maximum dialogs to return." },
|
|
174
174
|
space: stringToolParam("Optional space id or URL.")
|
|
175
175
|
});
|
|
176
|
-
add("readDialog",
|
|
177
|
-
dialog: stringToolParam("Dialog dbKey (dialog-<userId>-<id>), dialog URL, or bare id (
|
|
178
|
-
|
|
176
|
+
add("readDialog", `Read one persisted dialog (metadata + messages) by full dbKey (dialog-<userId>-<id>) or URL. Use listDialogs first if target is unclear; a bare id resolves against the current user, pass user for someone else's dialog. Reading an agent run's dialog is fine at any time, but do not poll a still-running one through the full transcript: if controlAgentRun is available prefer it for live runs, otherwise use mode="status" for a compact snapshot, and pull the full transcript once the run is done/failed/cancelled.`, {
|
|
177
|
+
dialog: stringToolParam("Dialog dbKey (dialog-<userId>-<id>), dialog URL, or bare id (resolved against user/current account)."),
|
|
178
|
+
mode: {
|
|
179
|
+
type: "string",
|
|
180
|
+
enum: ["full", "status"],
|
|
181
|
+
description: "full (default) returns meta + messages; status returns a compact run snapshot (status/checkpoint/tools/files/error) without the transcript \u2014 prefer it when you only need to know whether an agent run is still active or how it ended."
|
|
182
|
+
},
|
|
183
|
+
limit: { type: "integer", description: "Max messages to return in mode=full, newest first. Omit for the complete transcript; a small limit can hide earlier tool calls. Ignored in mode=status." },
|
|
184
|
+
user: stringToolParam("Owner userId for a bare dialog id (e.g. a child run started by another account). Ignored when dialog is a dbKey or URL."),
|
|
185
|
+
server: stringToolParam("Optional server base URL to read from, e.g. when the dialog lives on another machine's nolo server.")
|
|
179
186
|
}, ["dialog"]);
|
|
180
187
|
add("queryDialogsBySubjectRef", "Query persisted dialog evidence by a generic dialog.subjectRefs target.", {
|
|
181
188
|
rowDbKey: stringToolParam("Optional alias for subjectKind=table-row, subjectId=<rowDbKey>, subjectRole=task."),
|
|
@@ -491,9 +498,18 @@ function buildNoloWorkspaceCommandArgs(call) {
|
|
|
491
498
|
case "readDialog": {
|
|
492
499
|
const dialog = noloStringArg(args.dialog ?? args.dialogId ?? args.id);
|
|
493
500
|
if (!dialog) throw new Error("readDialog requires dialog.");
|
|
494
|
-
const
|
|
495
|
-
|
|
501
|
+
const mode = noloStringArg(args.mode);
|
|
502
|
+
if (mode && mode !== "full" && mode !== "status") {
|
|
503
|
+
throw new Error(`readDialog mode must be "full" or "status", got "${mode}".`);
|
|
504
|
+
}
|
|
505
|
+
const statusMode = mode === "status";
|
|
506
|
+
const cliArgs = ["dialog", statusMode ? "status" : "read", dialog];
|
|
507
|
+
const limit = statusMode ? null : noloPositiveIntegerString(args.limit);
|
|
496
508
|
if (limit) cliArgs.push(limit);
|
|
509
|
+
const user = noloStringArg(args.user ?? args.userId ?? args.owner);
|
|
510
|
+
if (user) cliArgs.push("--user", user);
|
|
511
|
+
const server = noloStringArg(args.server ?? args.serverBase ?? args.serverUrl);
|
|
512
|
+
if (server) cliArgs.push("--server", server);
|
|
497
513
|
return cliArgs;
|
|
498
514
|
}
|
|
499
515
|
case "queryDialogsBySubjectRef": {
|
|
@@ -6,17 +6,21 @@ import {
|
|
|
6
6
|
} from "./chunk-L3QFIBZG.js";
|
|
7
7
|
import {
|
|
8
8
|
addContentAction
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-DBUNOYLF.js";
|
|
10
10
|
import {
|
|
11
11
|
upload
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-JYSXE6LE.js";
|
|
13
13
|
import {
|
|
14
14
|
PUBLIC_DEEPSEEK_V4_FLASH_AGENT_KEY,
|
|
15
|
-
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY
|
|
16
|
-
|
|
15
|
+
PUBLIC_KIMI_K26_IMAGE_AGENT_KEY,
|
|
16
|
+
builtinRuntimeFallbackEntries
|
|
17
|
+
} from "./chunk-NWT2WUCY.js";
|
|
17
18
|
import {
|
|
18
19
|
getRuntimeServerContext
|
|
19
20
|
} from "./chunk-XMLRJUU5.js";
|
|
21
|
+
import {
|
|
22
|
+
publicAgentKey
|
|
23
|
+
} from "./chunk-SLOGKB7M.js";
|
|
20
24
|
import {
|
|
21
25
|
API_ENDPOINTS
|
|
22
26
|
} from "./chunk-LCBAMY2M.js";
|
|
@@ -24,6 +28,47 @@ import {
|
|
|
24
28
|
normalizeServerOrigin
|
|
25
29
|
} from "./chunk-CF7PE763.js";
|
|
26
30
|
|
|
31
|
+
// packages/agent-runtime/builtinPlatformAgentConfigs.ts
|
|
32
|
+
function buildConfig(e) {
|
|
33
|
+
const key = publicAgentKey(e.id);
|
|
34
|
+
const rawRecord = {
|
|
35
|
+
dbKey: key,
|
|
36
|
+
isPublic: true,
|
|
37
|
+
provider: e.provider,
|
|
38
|
+
model: e.model,
|
|
39
|
+
apiSource: e.apiSource ?? "platform",
|
|
40
|
+
useServerProxy: e.useServerProxy ?? true
|
|
41
|
+
};
|
|
42
|
+
if (e.hasImageOutput) rawRecord.hasImageOutput = true;
|
|
43
|
+
if (e.imageModel) rawRecord.imageModel = e.imageModel;
|
|
44
|
+
if (e.imageWorkflow) rawRecord.imageWorkflow = e.imageWorkflow;
|
|
45
|
+
if (e.imageConfig) rawRecord.imageConfig = e.imageConfig;
|
|
46
|
+
return {
|
|
47
|
+
key,
|
|
48
|
+
name: e.name,
|
|
49
|
+
provider: e.provider,
|
|
50
|
+
model: e.model,
|
|
51
|
+
apiSource: e.apiSource ?? "platform",
|
|
52
|
+
useServerProxy: e.useServerProxy ?? true,
|
|
53
|
+
rawRecord
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var BUILTIN_PLATFORM_AGENT_CONFIGS = Object.fromEntries(
|
|
57
|
+
builtinRuntimeFallbackEntries().map((e) => [publicAgentKey(e.id), buildConfig(e)])
|
|
58
|
+
);
|
|
59
|
+
function resolveBuiltinPlatformAgentConfig(agentRef) {
|
|
60
|
+
return BUILTIN_PLATFORM_AGENT_CONFIGS[agentRef] ?? null;
|
|
61
|
+
}
|
|
62
|
+
function resolveBuiltinPlatformAgentRecord(agentRef) {
|
|
63
|
+
const config = resolveBuiltinPlatformAgentConfig(agentRef);
|
|
64
|
+
if (!config) return null;
|
|
65
|
+
return {
|
|
66
|
+
...config.rawRecord,
|
|
67
|
+
dbKey: agentRef,
|
|
68
|
+
...config.name ? { name: config.name } : {}
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
27
72
|
// packages/ai/context/tokenUtils.ts
|
|
28
73
|
var estimateTokenCount = (text) => {
|
|
29
74
|
if (!text) return 0;
|
|
@@ -608,6 +653,8 @@ var DEFAULT_AUTO_EXECUTION_PROFILE = AUTO_EXECUTION_PROFILES[DEFAULT_AUTO_EXECUT
|
|
|
608
653
|
var resolveAutoExecutionProfile = (tier) => AUTO_EXECUTION_PROFILES[tier ?? DEFAULT_AUTO_EXECUTION_TIER] ?? DEFAULT_AUTO_EXECUTION_PROFILE;
|
|
609
654
|
|
|
610
655
|
export {
|
|
656
|
+
resolveBuiltinPlatformAgentConfig,
|
|
657
|
+
resolveBuiltinPlatformAgentRecord,
|
|
611
658
|
planContextUsage,
|
|
612
659
|
estimateTokenCount,
|
|
613
660
|
DEFAULT_CONTEXT_WINDOW,
|