nolo-cli 0.12.0-alpha.7 → 0.12.0-alpha.8
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-Q4IYLZS4.js → _executeModel-PKRZBH3J.js} +15 -14
- package/{agentDeleteCommand-7KI5P63D.js → agentDeleteCommand-OKQ5CSX2.js} +10 -9
- package/{agentEmailCommands-DEMUYI4P.js → agentEmailCommands-7DORWXQH.js} +18 -17
- package/{agentListCommands-UOKKEHD5.js → agentListCommands-VTR33V4B.js} +11 -10
- package/{agentMachineCommands-P6O6QHTM.js → agentMachineCommands-XHFM4UQB.js} +10 -9
- package/{agentRecordCommands-YTDXSM7M.js → agentRecordCommands-XB7XBNJ7.js} +18 -17
- package/{agentRunCommand-THSCEIK2.js → agentRunCommand-XACEWDVO.js} +18 -17
- package/{agentRuntimeLocal-URCNA6VW.js → agentRuntimeLocal-NYFVPD5P.js} +7 -6
- package/{agentSlice-X6ULYPOA.js → agentSlice-NGZWIMZX.js} +1 -1
- package/{chunk-6TISG7CK.js → chunk-3GOA33JO.js} +69 -12
- package/{chunk-F4RTTHOQ.js → chunk-4LNEIK4O.js} +3 -3
- package/chunk-5MMAK75Q.js +15 -0
- package/{chunk-ZPPBDWKK.js → chunk-6KTC3MPK.js} +1 -1
- package/{chunk-BLX7A3UL.js → chunk-7CQLSRAC.js} +2 -2
- package/{chunk-Z2BX5TKZ.js → chunk-7F5C7ILS.js} +2 -2
- package/{chunk-REH2ABIG.js → chunk-A22NOC7Y.js} +15 -13
- package/{chunk-3ERGZN5Y.js → chunk-CGAYFFIB.js} +1 -1
- package/{chunk-Y3BLUPNS.js → chunk-H5Y2H2N6.js} +1 -1
- package/{chunk-WWIMZXTC.js → chunk-HO7RHQIN.js} +1 -1
- package/{chunk-C6C43FKQ.js → chunk-HYJNPPQ6.js} +3 -3
- package/{chunk-NAEAB62H.js → chunk-JFANOO7I.js} +0 -12
- package/{chunk-R64KFNTS.js → chunk-LBWFOYJJ.js} +2 -2
- package/{chunk-D5UOJGZU.js → chunk-LKVDZQGM.js} +1 -1
- package/{chunk-7HV5OHEM.js → chunk-LUKQQJFL.js} +38 -1
- package/{chunk-DWXS7QEV.js → chunk-NS3DRNUZ.js} +38 -11
- package/{chunk-72PCQ5XQ.js → chunk-P3J54V3I.js} +1 -1
- package/{chunk-5KXZEOB6.js → chunk-QYZ46ZC3.js} +1 -1
- package/{chunk-EGPNTKU2.js → chunk-REQCG2PB.js} +10 -97
- package/{chunk-PKDL3HPF.js → chunk-SDYIF6SV.js} +94 -1
- package/{chunk-QTNKHFAK.js → chunk-SKURMCJF.js} +9 -9
- package/{chunk-YCXS3OPT.js → chunk-TA7VKOHU.js} +10 -5
- package/{chunk-WO24IT3V.js → chunk-TYPHUVK5.js} +12 -0
- package/{chunk-2XFDQEXO.js → chunk-UNEZBV37.js} +27 -13
- package/{chunk-GEJ3NVPG.js → chunk-UP6JMU6C.js} +1 -1
- package/{chunk-YRWNTL6W.js → chunk-UWTMBOPF.js} +13 -8
- package/{chunk-UIYF67QX.js → chunk-XNV42PMD.js} +9 -9
- package/{createAgentAutomationAction-2RY5SO76.js → createAgentAutomationAction-AHSBJKGX.js} +4 -3
- package/{createDialogAction-ZBASPHZU.js → createDialogAction-RSNVGR5E.js} +5 -4
- package/{createPageAction-F5IAHELK.js → createPageAction-47G4D5WU.js} +4 -3
- package/{dialogCommands-3THDF2JT.js → dialogCommands-MPUFCOBR.js} +11 -10
- package/{dialogSlice-K2USDPWM.js → dialogSlice-YNEFYFSU.js} +4 -3
- package/{docCreateCommands-ZBB5YVX6.js → docCreateCommands-LV6KUDP3.js} +10 -9
- package/{docDeleteCommands-6K7UJDRZ.js → docDeleteCommands-Y7FOYWMY.js} +11 -10
- package/{docReadCommands-W3G6RMEK.js → docReadCommands-UCCHERCP.js} +10 -9
- package/{docStore-UPTODHEV.js → docStore-OBBYKQVD.js} +5 -4
- package/{docUpdateCommands-B3BNRXSH.js → docUpdateCommands-FBKQBFWG.js} +10 -9
- package/{handleSendMessageAction-VZNBYBOR.js → handleSendMessageAction-U5AX6CGB.js} +4 -3
- package/index.js +36 -36
- package/{machineCommands-DEIHAXA4.js → machineCommands-EXVWHGWU.js} +17 -16
- package/{machineWsRunDispatch-EOCGXTWR.js → machineWsRunDispatch-QZXCW3SI.js} +17 -16
- package/package.json +1 -1
- package/{readlineWorkspace-5EUY7IQZ.js → readlineWorkspace-QKMGLM33.js} +128 -28
- package/{runAgentClientLoop-BG7MN7X7.js → runAgentClientLoop-5DIJHAPN.js} +12 -11
- package/{spaceCommands-K5BQGCFE.js → spaceCommands-KDZYXP5N.js} +10 -9
- package/{spaceSlice-5VGNKIE4.js → spaceSlice-EO6JQRMP.js} +4 -3
- package/{streamAgentChatTurn-Y4AAGJJG.js → streamAgentChatTurn-PLKJ3MZ6.js} +14 -13
- package/{tools-HG53NEI2.js → tools-5QNY6YKE.js} +7 -6
- package/{tuiSummaryLlmCaller-YEHSPGXZ.js → tuiSummaryLlmCaller-TQ34DAM5.js} +4 -2
- package/{updateDialogTitleAction-3F5SATT4.js → updateDialogTitleAction-V5AD52MZ.js} +4 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
updateContentTitle
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-XNV42PMD.js";
|
|
4
4
|
import {
|
|
5
5
|
require_date_fns
|
|
6
6
|
} from "./chunk-M76ECQRD.js";
|
|
@@ -367,7 +367,7 @@ async function saveDocState(arg, { dispatch, getState }) {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
async function createDocState(args, thunkApi) {
|
|
370
|
-
const { createPageAction } = await import("./createPageAction-
|
|
370
|
+
const { createPageAction } = await import("./createPageAction-47G4D5WU.js");
|
|
371
371
|
return createPageAction(args, thunkApi);
|
|
372
372
|
}
|
|
373
373
|
function subscribe(listener) {
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
isBuiltinNoloAgentRef,
|
|
19
19
|
t,
|
|
20
20
|
toolLabel
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NS3DRNUZ.js";
|
|
22
22
|
import {
|
|
23
23
|
CliProviderQuotaError
|
|
24
24
|
} from "./chunk-CMKUBIGW.js";
|
|
@@ -28,10 +28,10 @@ import {
|
|
|
28
28
|
import {
|
|
29
29
|
readDbRecord,
|
|
30
30
|
resolveAgentRecordFromHybridStore
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-CGAYFFIB.js";
|
|
32
32
|
import {
|
|
33
33
|
normalizeAgentHandle
|
|
34
|
-
} from "./chunk-
|
|
34
|
+
} from "./chunk-QYZ46ZC3.js";
|
|
35
35
|
import {
|
|
36
36
|
NOLO_PROJECT_MANAGER_AGENT_KEY,
|
|
37
37
|
isLocalCliAgentKey
|
|
@@ -48,14 +48,14 @@ import {
|
|
|
48
48
|
formatStatusRunCard,
|
|
49
49
|
formatStopRunCard,
|
|
50
50
|
isAgentRunTerminalStatus
|
|
51
|
-
} from "./chunk-
|
|
51
|
+
} from "./chunk-SKURMCJF.js";
|
|
52
52
|
import {
|
|
53
53
|
isGatewayHttpStatus
|
|
54
54
|
} from "./chunk-RQSOAMPJ.js";
|
|
55
55
|
import {
|
|
56
56
|
buildMemorySubjectsForAgent,
|
|
57
57
|
resolveAgentMemoryPolicy
|
|
58
|
-
} from "./chunk-
|
|
58
|
+
} from "./chunk-LKVDZQGM.js";
|
|
59
59
|
import {
|
|
60
60
|
parseExternalSkillMarkdown,
|
|
61
61
|
parseSkillDocProtocol
|
|
@@ -64,14 +64,14 @@ import {
|
|
|
64
64
|
API_REPORTED_COST_MULTIPLIER,
|
|
65
65
|
normalizeUsage,
|
|
66
66
|
parseUiAskChoiceContent
|
|
67
|
-
} from "./chunk-
|
|
67
|
+
} from "./chunk-XNV42PMD.js";
|
|
68
68
|
import {
|
|
69
69
|
buildSkillDiscoveryContextBlock
|
|
70
70
|
} from "./chunk-AS3ZQ3O2.js";
|
|
71
71
|
import {
|
|
72
72
|
buildPlatformChatCompletionRequest,
|
|
73
73
|
parsePlatformChatCompletionData
|
|
74
|
-
} from "./chunk-
|
|
74
|
+
} from "./chunk-3GOA33JO.js";
|
|
75
75
|
import {
|
|
76
76
|
resolveAgentRuntimeConfigFromRecord
|
|
77
77
|
} from "./chunk-NCGFB7NN.js";
|
|
@@ -80,15 +80,17 @@ import {
|
|
|
80
80
|
LOCAL_TURN_ABORTED_CODE,
|
|
81
81
|
readActionGate,
|
|
82
82
|
readCommandActionGatePayload
|
|
83
|
-
} from "./chunk-
|
|
83
|
+
} from "./chunk-TA7VKOHU.js";
|
|
84
84
|
import {
|
|
85
85
|
resolvePlatformChatCompletionsEndpoint
|
|
86
|
-
} from "./chunk-
|
|
86
|
+
} from "./chunk-TYPHUVK5.js";
|
|
87
87
|
import {
|
|
88
88
|
DEFAULT_CONTEXT_WINDOW,
|
|
89
|
-
clipCompactText,
|
|
90
89
|
getModelContextWindow
|
|
91
|
-
} from "./chunk-
|
|
90
|
+
} from "./chunk-JFANOO7I.js";
|
|
91
|
+
import {
|
|
92
|
+
clipCompactText
|
|
93
|
+
} from "./chunk-5MMAK75Q.js";
|
|
92
94
|
import {
|
|
93
95
|
findModelConfig
|
|
94
96
|
} from "./chunk-OGGHETUE.js";
|
|
@@ -3588,7 +3590,7 @@ function findCollapsedPasteSpanAt(buffer, pos, opts = {}) {
|
|
|
3588
3590
|
// packages/cli/client/agentRun.ts
|
|
3589
3591
|
import { ulid } from "ulid";
|
|
3590
3592
|
async function loadRunLocalAgentTurn() {
|
|
3591
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
3593
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-NYFVPD5P.js");
|
|
3592
3594
|
return runLocalAgentTurn;
|
|
3593
3595
|
}
|
|
3594
3596
|
async function resolveCurrentMachineId(options) {
|
|
@@ -4025,7 +4027,7 @@ async function runLocalAgentTurnForCli(options, settings) {
|
|
|
4025
4027
|
} : void 0;
|
|
4026
4028
|
const currentDialogId = options.continueDialogId ?? ulid();
|
|
4027
4029
|
const runChildTurn = async (input) => {
|
|
4028
|
-
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-
|
|
4030
|
+
const { runLocalAgentTurn } = await import("./agentRuntimeLocal-NYFVPD5P.js");
|
|
4029
4031
|
return runLocalAgentTurn(input);
|
|
4030
4032
|
};
|
|
4031
4033
|
const createFreshChildBaseAdapter = () => {
|
|
@@ -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-PKRZBH3J.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-5DIJHAPN.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-PLKJ3MZ6.js");
|
|
341
341
|
return streamAgentChatTurnHandler(args, thunkApi);
|
|
342
342
|
}),
|
|
343
343
|
/**
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
MODEL_LOOKUP_MAP
|
|
3
3
|
} from "./chunk-OGGHETUE.js";
|
|
4
|
-
import {
|
|
5
|
-
compactWhitespace
|
|
6
|
-
} from "./chunk-DWLEOOGR.js";
|
|
7
4
|
import {
|
|
8
5
|
ALL_MODELS
|
|
9
6
|
} from "./chunk-IKXL2HZ3.js";
|
|
@@ -2083,14 +2080,6 @@ var normalizeAssistantContentBuffer = async (contentBuffer, dialogId, messageId,
|
|
|
2083
2080
|
return updated;
|
|
2084
2081
|
};
|
|
2085
2082
|
|
|
2086
|
-
// packages/core/clipCompactText.ts
|
|
2087
|
-
function clipCompactText(value, max, ellipsis = "...") {
|
|
2088
|
-
const compact = compactWhitespace(value);
|
|
2089
|
-
if (compact.length <= max) return compact;
|
|
2090
|
-
if (max <= ellipsis.length) return compact.slice(0, max);
|
|
2091
|
-
return `${compact.slice(0, max - ellipsis.length)}${ellipsis}`;
|
|
2092
|
-
}
|
|
2093
|
-
|
|
2094
2083
|
// packages/ai/context/retention.ts
|
|
2095
2084
|
var SAFE_BUFFER_RATIO = 0.95;
|
|
2096
2085
|
var CACHE_FIRST_RETENTION_STRENGTH = 0.95;
|
|
@@ -2273,7 +2262,6 @@ function planCompression(input) {
|
|
|
2273
2262
|
}
|
|
2274
2263
|
|
|
2275
2264
|
export {
|
|
2276
|
-
clipCompactText,
|
|
2277
2265
|
planContextUsage,
|
|
2278
2266
|
estimateTokenCount,
|
|
2279
2267
|
DEFAULT_CONTEXT_WINDOW,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
clearCliLocalRuntimePreparedAgentCache
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NS3DRNUZ.js";
|
|
4
4
|
import {
|
|
5
5
|
getReadableCliDb
|
|
6
6
|
} from "./chunk-W4NVOSFF.js";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
resolveAgentRecordFromHybridStore,
|
|
13
13
|
sanitizeAgentRecordForCliOutput,
|
|
14
14
|
writeAgentRecord
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CGAYFFIB.js";
|
|
16
16
|
import {
|
|
17
17
|
resolveCliAgentKeyInput
|
|
18
18
|
} from "./chunk-VHBWHNVT.js";
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
+
import {
|
|
2
|
+
isImageUrlPart
|
|
3
|
+
} from "./chunk-TYPHUVK5.js";
|
|
1
4
|
import {
|
|
2
5
|
canonicalizeToolNames
|
|
3
6
|
} from "./chunk-B4KT7RN2.js";
|
|
7
|
+
import {
|
|
8
|
+
asTrimmedLowercaseString
|
|
9
|
+
} from "./chunk-QSJ3HFEF.js";
|
|
4
10
|
import {
|
|
5
11
|
asTrimmedString
|
|
6
12
|
} from "./chunk-3EUW3WEO.js";
|
|
@@ -232,8 +238,39 @@ var buildCurrentTimeBlock = (now = /* @__PURE__ */ new Date(), timeZone = resolv
|
|
|
232
238
|
"\u5F53\u7528\u6237\u8BF4\u201C\u4ECA\u5929\u201D\u201C\u4ECA\u65E5\u201D\u6216 today \u65F6\uFF0C\u9ED8\u8BA4\u6307\u5F53\u524D\u672C\u5730\u65E5\u671F\uFF0C\u9664\u975E\u7528\u6237\u660E\u786E\u7ED9\u51FA\u5176\u5B83\u65E5\u671F\u3002"
|
|
233
239
|
].join("\n");
|
|
234
240
|
|
|
241
|
+
// packages/core/chat/bareImageUrlShape.ts
|
|
242
|
+
function requiresBareImageUrl(args) {
|
|
243
|
+
const model = asTrimmedLowercaseString(args.model);
|
|
244
|
+
if (!model.startsWith("gpt-")) return false;
|
|
245
|
+
const provider = asTrimmedLowercaseString(args.provider);
|
|
246
|
+
if (provider === "opencode-go") return true;
|
|
247
|
+
return asTrimmedLowercaseString(args.endpoint).includes("opencode.ai/zen/go");
|
|
248
|
+
}
|
|
249
|
+
function toBareImageUrlContent(content) {
|
|
250
|
+
if (!Array.isArray(content)) return content;
|
|
251
|
+
let changed = false;
|
|
252
|
+
const parts = content.map((part) => {
|
|
253
|
+
if (!isImageUrlPart(part)) return part;
|
|
254
|
+
const imageUrl = part.image_url;
|
|
255
|
+
if (!imageUrl || typeof imageUrl !== "object") return part;
|
|
256
|
+
const url = imageUrl.url;
|
|
257
|
+
if (typeof url !== "string" || !url) return part;
|
|
258
|
+
changed = true;
|
|
259
|
+
return { ...part, image_url: url };
|
|
260
|
+
});
|
|
261
|
+
return changed ? parts : content;
|
|
262
|
+
}
|
|
263
|
+
function toBareImageUrlMessages(messages) {
|
|
264
|
+
return messages.map((message) => {
|
|
265
|
+
const content = toBareImageUrlContent(message.content);
|
|
266
|
+
return content === message.content ? message : { ...message, content };
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
|
|
235
270
|
export {
|
|
236
271
|
buildIdentityBlock,
|
|
237
272
|
buildRuntimeGuidanceBlocks,
|
|
238
|
-
buildCurrentTimeBlock
|
|
273
|
+
buildCurrentTimeBlock,
|
|
274
|
+
requiresBareImageUrl,
|
|
275
|
+
toBareImageUrlMessages
|
|
239
276
|
};
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
buildLocalAgentLookupKeys,
|
|
13
13
|
normalizeAgentHandle,
|
|
14
14
|
shouldReadAgentKeyRemotely
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-QYZ46ZC3.js";
|
|
16
16
|
import {
|
|
17
17
|
LOCAL_CODEX_AGENT_ID,
|
|
18
18
|
LOCAL_CODEX_AGENT_KEY,
|
|
@@ -26,14 +26,15 @@ import {
|
|
|
26
26
|
buildCliPrompt
|
|
27
27
|
} from "./chunk-ATNTHIZI.js";
|
|
28
28
|
import {
|
|
29
|
+
inlineImageUrlsForCustomProvider,
|
|
29
30
|
prepareTools
|
|
30
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-SDYIF6SV.js";
|
|
31
32
|
import {
|
|
32
33
|
getAntigravityUserAgent,
|
|
33
34
|
isAntigravityOAuthAgent,
|
|
34
35
|
readAntigravityProjectId,
|
|
35
36
|
resolveAntigravityCloudCodeBaseUrl
|
|
36
|
-
} from "./chunk-
|
|
37
|
+
} from "./chunk-H5Y2H2N6.js";
|
|
37
38
|
import {
|
|
38
39
|
FORCED_TOOLS,
|
|
39
40
|
addDefaultLightWebToolsForConfiguredAgents,
|
|
@@ -49,7 +50,7 @@ import {
|
|
|
49
50
|
readXPostFunctionSchema,
|
|
50
51
|
readXhsProfileFunc,
|
|
51
52
|
readXhsProfileFunctionSchema
|
|
52
|
-
} from "./chunk-
|
|
53
|
+
} from "./chunk-SKURMCJF.js";
|
|
53
54
|
import {
|
|
54
55
|
createDrainExhaustedResponse,
|
|
55
56
|
isCoreDrainingBody,
|
|
@@ -61,13 +62,13 @@ import {
|
|
|
61
62
|
} from "./chunk-OWOHNGCN.js";
|
|
62
63
|
import {
|
|
63
64
|
prepareTokenUsageData
|
|
64
|
-
} from "./chunk-
|
|
65
|
+
} from "./chunk-XNV42PMD.js";
|
|
65
66
|
import {
|
|
66
67
|
BUILTIN_TITLE_LLM_CONFIG
|
|
67
68
|
} from "./chunk-V2J635L5.js";
|
|
68
69
|
import {
|
|
69
70
|
fetchServerSyncedCredential
|
|
70
|
-
} from "./chunk-
|
|
71
|
+
} from "./chunk-HYJNPPQ6.js";
|
|
71
72
|
import {
|
|
72
73
|
buildAgentRuntimeDialogWritePlan,
|
|
73
74
|
buildLocalWorkspaceOpenAiTools,
|
|
@@ -80,7 +81,7 @@ import {
|
|
|
80
81
|
parseSseDataLineJson,
|
|
81
82
|
readOpenAiCompatibleSseCompletion,
|
|
82
83
|
resolveOpenAiCompatibleProviderConfig
|
|
83
|
-
} from "./chunk-
|
|
84
|
+
} from "./chunk-UNEZBV37.js";
|
|
84
85
|
import {
|
|
85
86
|
buildPlatformChatCompletionRequest,
|
|
86
87
|
canUsePlatformChatProvider,
|
|
@@ -90,14 +91,14 @@ import {
|
|
|
90
91
|
resolveLegacyDeepSeekProxyChatFallback,
|
|
91
92
|
resolvePlatformChatProviderConfig,
|
|
92
93
|
shouldUsePlatformChatProvider
|
|
93
|
-
} from "./chunk-
|
|
94
|
+
} from "./chunk-3GOA33JO.js";
|
|
94
95
|
import {
|
|
95
96
|
resolveAgentRuntimeConfigFromRecord
|
|
96
97
|
} from "./chunk-NCGFB7NN.js";
|
|
97
98
|
import {
|
|
98
99
|
parseToolArgumentsJson,
|
|
99
100
|
summarizeToolArguments
|
|
100
|
-
} from "./chunk-
|
|
101
|
+
} from "./chunk-TA7VKOHU.js";
|
|
101
102
|
import {
|
|
102
103
|
buildLoadSkillExecutor,
|
|
103
104
|
buildNoloWorkspaceCliToolExecutors,
|
|
@@ -108,7 +109,7 @@ import {
|
|
|
108
109
|
} from "./chunk-B4KT7RN2.js";
|
|
109
110
|
import {
|
|
110
111
|
clipCompactText
|
|
111
|
-
} from "./chunk-
|
|
112
|
+
} from "./chunk-5MMAK75Q.js";
|
|
112
113
|
import {
|
|
113
114
|
createFileCredentialBroker,
|
|
114
115
|
resolveCurrentRunRuntimeToolPolicy,
|
|
@@ -10287,6 +10288,32 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10287
10288
|
model: providerConfig.model,
|
|
10288
10289
|
complete: async (messages, options) => {
|
|
10289
10290
|
const stream = Boolean(options?.onTextDelta);
|
|
10291
|
+
const inlinedMessages = (await inlineImageUrlsForCustomProvider(
|
|
10292
|
+
{ messages },
|
|
10293
|
+
{
|
|
10294
|
+
shouldInline: true,
|
|
10295
|
+
isAllowedImageUrl: (url) => {
|
|
10296
|
+
try {
|
|
10297
|
+
return new URL(url).origin === new URL(serverUrl).origin;
|
|
10298
|
+
} catch {
|
|
10299
|
+
return false;
|
|
10300
|
+
}
|
|
10301
|
+
},
|
|
10302
|
+
fetchImage: async (url) => {
|
|
10303
|
+
const response = await fetchImpl(url, {
|
|
10304
|
+
headers: authToken ? { Authorization: `Bearer ${authToken}` } : void 0
|
|
10305
|
+
});
|
|
10306
|
+
if (!response.ok) {
|
|
10307
|
+
return { ok: false, error: `HTTP ${response.status}` };
|
|
10308
|
+
}
|
|
10309
|
+
return {
|
|
10310
|
+
ok: true,
|
|
10311
|
+
mimeType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
10312
|
+
bytes: new Uint8Array(await response.arrayBuffer())
|
|
10313
|
+
};
|
|
10314
|
+
}
|
|
10315
|
+
}
|
|
10316
|
+
)).messages;
|
|
10290
10317
|
logLocalRuntimeDiagnostic("provider.request.start", {
|
|
10291
10318
|
agentKey: agentConfig.key,
|
|
10292
10319
|
transport: "direct-openai-compatible",
|
|
@@ -10300,7 +10327,7 @@ function createCliLocalRuntimeAdapter(deps) {
|
|
|
10300
10327
|
});
|
|
10301
10328
|
const result = await executeOpenAiCompatibleChatCompletion({
|
|
10302
10329
|
providerConfig,
|
|
10303
|
-
messages,
|
|
10330
|
+
messages: inlinedMessages,
|
|
10304
10331
|
tools,
|
|
10305
10332
|
fetchImpl: (url, init) => fetchWithTransientRetry(fetchImpl, url, init, {
|
|
10306
10333
|
sleep: deps.sleep,
|
|
@@ -2,11 +2,13 @@ import {
|
|
|
2
2
|
clipHeadAndTail
|
|
3
3
|
} from "./chunk-JEXVIMYZ.js";
|
|
4
4
|
import {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
inlineImageUrlsForCustomProvider,
|
|
6
|
+
prepareTools,
|
|
7
|
+
shouldInlineImageUrlsForAgent
|
|
8
|
+
} from "./chunk-SDYIF6SV.js";
|
|
7
9
|
import {
|
|
8
10
|
performFetchRequest
|
|
9
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-UWTMBOPF.js";
|
|
10
12
|
import {
|
|
11
13
|
createSSEParser,
|
|
12
14
|
createToolRunId,
|
|
@@ -17,7 +19,7 @@ import {
|
|
|
17
19
|
toolRunSetPending,
|
|
18
20
|
toolRunStarted,
|
|
19
21
|
toolRunSucceeded
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-SKURMCJF.js";
|
|
21
23
|
import {
|
|
22
24
|
getPublicImageAgentMode
|
|
23
25
|
} from "./chunk-VIDPVFP3.js";
|
|
@@ -27,13 +29,13 @@ import {
|
|
|
27
29
|
messageStreaming,
|
|
28
30
|
selectCurrentSpaceId,
|
|
29
31
|
updateToolMessage
|
|
30
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-XNV42PMD.js";
|
|
31
33
|
import {
|
|
32
34
|
streamAgentChatTurn
|
|
33
|
-
} from "./chunk-
|
|
35
|
+
} from "./chunk-HYJNPPQ6.js";
|
|
34
36
|
import {
|
|
35
37
|
EMPTY_ASSISTANT_REPAIR_PROMPT
|
|
36
|
-
} from "./chunk-
|
|
38
|
+
} from "./chunk-TA7VKOHU.js";
|
|
37
39
|
import {
|
|
38
40
|
createThinkParserState,
|
|
39
41
|
flushThinkParser,
|
|
@@ -41,7 +43,7 @@ import {
|
|
|
41
43
|
} from "./chunk-OPZYGHUC.js";
|
|
42
44
|
import {
|
|
43
45
|
getModelInfo
|
|
44
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-JFANOO7I.js";
|
|
45
47
|
import {
|
|
46
48
|
getApiEndpoint
|
|
47
49
|
} from "./chunk-OGGHETUE.js";
|
|
@@ -56,9 +58,6 @@ import {
|
|
|
56
58
|
import {
|
|
57
59
|
toErrorMessage
|
|
58
60
|
} from "./chunk-HNMXYYJR.js";
|
|
59
|
-
import {
|
|
60
|
-
isNoloHostedProvider
|
|
61
|
-
} from "./chunk-524BDL33.js";
|
|
62
61
|
import {
|
|
63
62
|
selectCurrentServer
|
|
64
63
|
} from "./chunk-JU7J7EAV.js";
|
|
@@ -998,92 +997,6 @@ function sanitizeOutboundResponsesInput(input, opts = {}) {
|
|
|
998
997
|
return result;
|
|
999
998
|
}
|
|
1000
999
|
|
|
1001
|
-
// packages/ai/chat/inlineImageUrlsForCustomProvider.ts
|
|
1002
|
-
var FILE_CONTENT_PATH = "/api/v1/db/file/content/";
|
|
1003
|
-
var shouldInlineImageUrlsForAgent = (agentConfig) => {
|
|
1004
|
-
const apiSource = agentConfig?.apiSource?.toLowerCase();
|
|
1005
|
-
const provider = agentConfig?.provider?.toLowerCase();
|
|
1006
|
-
const model = agentConfig?.model?.toLowerCase();
|
|
1007
|
-
if (apiSource === "custom" || provider === "custom") return true;
|
|
1008
|
-
if (isNoloHostedProvider(provider)) return true;
|
|
1009
|
-
return provider === "openrouter" && model === "minimax/minimax-m3";
|
|
1010
|
-
};
|
|
1011
|
-
var isInlineCandidate = (url) => /^https?:\/\//i.test(url) && url.includes(FILE_CONTENT_PATH);
|
|
1012
|
-
var bytesToBase64 = (bytes) => {
|
|
1013
|
-
let binary = "";
|
|
1014
|
-
for (const byte of bytes) {
|
|
1015
|
-
binary += String.fromCharCode(byte);
|
|
1016
|
-
}
|
|
1017
|
-
return btoa(binary);
|
|
1018
|
-
};
|
|
1019
|
-
var defaultFetchImage = async (url) => {
|
|
1020
|
-
const response = await fetch(url);
|
|
1021
|
-
if (!response.ok) {
|
|
1022
|
-
return {
|
|
1023
|
-
ok: false,
|
|
1024
|
-
error: `HTTP ${response.status}`
|
|
1025
|
-
};
|
|
1026
|
-
}
|
|
1027
|
-
const bytes = new Uint8Array(await response.arrayBuffer());
|
|
1028
|
-
return {
|
|
1029
|
-
ok: true,
|
|
1030
|
-
mimeType: response.headers.get("content-type") ?? "application/octet-stream",
|
|
1031
|
-
bytes
|
|
1032
|
-
};
|
|
1033
|
-
};
|
|
1034
|
-
var cloneImagePartWithDataUrl = async (part, fetchImage) => {
|
|
1035
|
-
const url = part?.image_url?.url;
|
|
1036
|
-
if (typeof url !== "string" || !isInlineCandidate(url)) return part;
|
|
1037
|
-
const result = await fetchImage(url);
|
|
1038
|
-
if (!result.ok || !result.bytes) {
|
|
1039
|
-
throw new Error(
|
|
1040
|
-
`Failed to inline custom provider image URL ${url}: ${result.error ?? "unknown error"}`
|
|
1041
|
-
);
|
|
1042
|
-
}
|
|
1043
|
-
const mimeType = result.mimeType || "application/octet-stream";
|
|
1044
|
-
return {
|
|
1045
|
-
...part,
|
|
1046
|
-
image_url: {
|
|
1047
|
-
...part.image_url,
|
|
1048
|
-
url: `data:${mimeType};base64,${bytesToBase64(result.bytes)}`
|
|
1049
|
-
}
|
|
1050
|
-
};
|
|
1051
|
-
};
|
|
1052
|
-
var inlineImageUrlsForCustomProvider = async (bodyData, options) => {
|
|
1053
|
-
if (!options.shouldInline) return bodyData;
|
|
1054
|
-
const body = bodyData;
|
|
1055
|
-
if (!Array.isArray(body?.messages)) return bodyData;
|
|
1056
|
-
const fetchImage = options.fetchImage ?? defaultFetchImage;
|
|
1057
|
-
let changed = false;
|
|
1058
|
-
const messages = [];
|
|
1059
|
-
for (const message of body.messages) {
|
|
1060
|
-
if (!Array.isArray(message?.content)) {
|
|
1061
|
-
messages.push(message);
|
|
1062
|
-
continue;
|
|
1063
|
-
}
|
|
1064
|
-
const content = await Promise.all(
|
|
1065
|
-
message.content.map(async (part) => {
|
|
1066
|
-
if (part?.type !== "image_url") return part;
|
|
1067
|
-
return cloneImagePartWithDataUrl(part, fetchImage);
|
|
1068
|
-
})
|
|
1069
|
-
);
|
|
1070
|
-
let messageChanged = false;
|
|
1071
|
-
for (let i = 0; i < content.length; i++) {
|
|
1072
|
-
if (content[i] !== message.content[i]) {
|
|
1073
|
-
changed = true;
|
|
1074
|
-
messageChanged = true;
|
|
1075
|
-
break;
|
|
1076
|
-
}
|
|
1077
|
-
}
|
|
1078
|
-
messages.push(messageChanged ? { ...message, content } : message);
|
|
1079
|
-
}
|
|
1080
|
-
if (!changed) return bodyData;
|
|
1081
|
-
return {
|
|
1082
|
-
...body,
|
|
1083
|
-
messages
|
|
1084
|
-
};
|
|
1085
|
-
};
|
|
1086
|
-
|
|
1087
1000
|
// packages/ai/chat/streamReader.ts
|
|
1088
1001
|
function createAbortError(message = "The operation was aborted.") {
|
|
1089
1002
|
return new DOMException(message, "AbortError");
|